From: Tomas Janousek <tomi@nomi.cz>
To: ntg-context@ntg.nl
Subject: broken links in PDF included via \copypages (PoC fix attached)
Date: Fri, 22 Mar 2019 15:35:24 +0100 [thread overview]
Message-ID: <20190322143524.vznre2qno3vic7iq@nomi.cz> (raw)
[-- Attachment #1: Type: text/plain, Size: 2190 bytes --]
Hello,
I happen to need to include a PDF which uses unusual link annotations. Instead
of something like:
<< /A << /D (aff1a) /S /GoTo >> /Border [ 0 0 0 ] /C [ 1 0 0 ] /F 4 /H /I /Rect [ 104.214 577.913 110.231 586.941 ] /Subtype /Link /Type /Annot >>
there's
<< /Border [ 0 0 0 ] /C [ 1 0 0 ] /Dest (aff0001) /H /I /Rect [ 109.005 570.781 115.335 584.308 ] /Subtype /Link /Type /Annot >>
The error I'm getting is:
backend > link > missing link annotation
This appears to be okay according to PDF reference [PDFref, pages 492 and
501], and it's also supported in poppler [poppler-link]. But it's not
supported in lpdf-epd.lua.
[PDFref]: https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/pdf_reference_archives/PDFReference.pdf
[popplet-link]: https://github.com/danigm/poppler/blob/0011805e22193b690b99a53dcb9986ce04eb3eb4/poppler/Link.cc#L914-L924
I applied this workaround and it fixed the issue for me:
--- /usr/share/texmf/tex/context/base/mkiv/lpdf-epa.lua 2018-03-20 23:10:59.000000000 +0100
+++ lpdf-epa-fixed.lua 2019-03-22 15:11:49.078873530 +0100
@@ -230,6 +230,12 @@
local w = xscale * (a_urx - a_llx)
local h = yscale * (a_ury - a_lly)
if subtype == "Link" then
+ if not annotation.A and annotation.Dest then
+ annotation.A = {}
+ annotation.A.S = "GoTo"
+ annotation.A.D = annotation.Dest
+ end
+
local a = annotation.A
if not a then
report_link("missing link annotation")
Please consider applying a similar fix to the ConTeXt source code. Thanks!
I'm not sure I can attach the actual PDF as it's a recent Elsevier pub, but I
managed to manually craft one from the ConTeXt hello world using qpdf
--stream-data=uncompress --object-streams=disable and vim, and I'm attaching
that. The equation references work in PDF readers but stop working after
passing through \copypages[Hello-world-weird.pdf][][interaction=yes].
--
Tomáš Janoušek, a.k.a. Pivník, a.k.a. Liskni_si, http://work.lisk.in/
[-- Attachment #2: Hello-world-weird.pdf --]
[-- Type: application/pdf, Size: 71105 bytes --]
[-- Attachment #3: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next reply other threads:[~2019-03-22 14:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 14:35 Tomas Janousek [this message]
2019-03-22 17:07 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190322143524.vznre2qno3vic7iq@nomi.cz \
--to=tomi@nomi.cz \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).