ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Tomas Janousek <tomi@nomi.cz>, ntg-context@ntg.nl
Subject: Re: broken links in PDF included via \copypages (PoC fix attached)
Date: Fri, 22 Mar 2019 18:07:48 +0100	[thread overview]
Message-ID: <16beed2e-212c-f845-263e-a710c471995a@xs4all.nl> (raw)
In-Reply-To: <20190322143524.vznre2qno3vic7iq@nomi.cz>

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_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!

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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

      reply	other threads:[~2019-03-22 17:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 14:35 Tomas Janousek
2019-03-22 17:07 ` Hans Hagen [this message]

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=16beed2e-212c-f845-263e-a710c471995a@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=tomi@nomi.cz \
    /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).