ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] (feature proposal) link to attachments: /GoToE
@ 2023-09-03 10:17 Pablo Rodriguez
  2023-09-03 10:46 ` [NTG-context] " Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez @ 2023-09-03 10:17 UTC (permalink / raw)
  To: ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-03 17:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-03 10:17 [NTG-context] (feature proposal) link to attachments: /GoToE Pablo Rodriguez
2023-09-03 10:46 ` [NTG-context] " Hans Hagen
2023-09-03 11:03   ` Pablo Rodriguez
2023-09-03 14:02     ` Henning Hraban Ramm
2023-09-03 17:23       ` Pablo Rodriguez

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).