Hi Hans,

having attachments in PDF is very useful, but the vast majority of
people don’t know how to handle them (even with the attachment pane
displayed when Acrobat opens the document, or with file annotation).

It would be really useful to have a link with destination that it would
open the embedded document (when clicked).

Since in its basic functionality, this is very similar to links to
external documents (GoToR), I wonder whether it would be possible to
implement links to embedded documents (GoToE,
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#G11.2048909).

At least to begin with, only links to embedded children documents would
be required.

If this GoToR is generated by ConTeXt from
"\goto{whatever}[destination-doc::page(15)]":

  17 0 obj
  <<
    /D [ 14 /Fit ]
    /F (destination-doc.pdf)
    /NewWindow true
    /S /GoToR
  >>
  endobj

A GoToE destination for "\attachment[file=destination-doc.pdf,
method=hidden]" would read:

  1 0 obj
   <<
    /S /GoToE
    /D [ 14 /Fit ]
    /NewWindow true
    /T << /R /C
          /N (destination-doc.pdf) >>
   >>
  endobj

With EmbeddedFiles, the F entry from GoToR is a target dictionary (T
key) in GoToE.

The T dictionary contains the relation (R key) to the destination file
(only C, child, needed) and the name (N) from EmbeddedFiles/Names for
the attachment.

This is the most basic implementation that allows to link to an
attachment.

What the spec describes as “a complete facility for linking between a
file in a hierarchy of nested embedded files and another file in the
same or different hierarchy” is probably unnecesarily complex (even to
use).

With file annotations, instead of the name from EmbeddedFiles/Names in
the target dictionary, it requires the keys P and A (as numbers or
strings).

  P gives the page number which contains the file annotation:
  zero-based as number, or named destination as string.

  A gives the annotation: zero-based index of the annotation in the
  Annots array, or NM entry value from the annotation object.

As for the interface, it would be great that GoToR links could be
converted automatically in "\goto{some text}[file::page(number)]" for
attached files.

This basic implementation of GoToE links would be extremely helpful to
access embedded documents (believe it or not, this is something I
explain almost every week at work).

I would be happy to provide the code to implement this, but I’m
afraid this is way beyond my knowledge.

Many thanks for your help,

Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to