broken links in PDF included via \copypages (PoC fix attached)
![](https://secure.gravatar.com/avatar/391a8b936b51adccd057c83e6ace7241.jpg?s=120&d=mm&r=g)
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_arch... [popplet-link]: https://github.com/danigm/poppler/blob/0011805e22193b690b99a53dcb9986ce04eb3... 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/
![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 3/22/2019 3:35 PM, Tomas Janousek wrote:
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_arch... [popplet-link]: https://github.com/danigm/poppler/blob/0011805e22193b690b99a53dcb9986ce04eb3...
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!
sure, it's a harmless patch and if it works ok ...
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].
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Tomas Janousek