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

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

On 9/3/2023 12:17 PM, Pablo Rodriguez wrote:
> 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.
remind me in a month or so ... i'm not going to touch that part of the 
code now (some other priorities)

Hans


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

* [NTG-context] Re: (feature proposal) link to attachments: /GoToE
  2023-09-03 10:46 ` [NTG-context] " Hans Hagen
@ 2023-09-03 11:03   ` Pablo Rodriguez
  2023-09-03 14:02     ` Henning Hraban Ramm
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez @ 2023-09-03 11:03 UTC (permalink / raw)
  To: ntg-context

On 9/3/23 12:46, Hans Hagen wrote:
> On 9/3/2023 12:17 PM, Pablo Rodriguez wrote:
>> [...]
>> 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.
> remind me in a month or so ... i'm not going to touch that part of the
> code now (some other priorities)

Perfectly fine for me, Hans.

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

* [NTG-context] Re: (feature proposal) link to attachments: /GoToE
  2023-09-03 11:03   ` Pablo Rodriguez
@ 2023-09-03 14:02     ` Henning Hraban Ramm
  2023-09-03 17:23       ` Pablo Rodriguez
  0 siblings, 1 reply; 5+ messages in thread
From: Henning Hraban Ramm @ 2023-09-03 14:02 UTC (permalink / raw)
  To: ntg-context

Am 03.09.23 um 13:03 schrieb Pablo Rodriguez:
> On 9/3/23 12:46, Hans Hagen wrote:
>> On 9/3/2023 12:17 PM, Pablo Rodriguez wrote:
>>> [...]
>>> 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.
>> remind me in a month or so ... i'm not going to touch that part of the
>> code now (some other priorities)
> 
> Perfectly fine for me, Hans.

While I don’t know what’s missing under the hood, I think there’s just a 
“reference” key missing in \attachment or \setupattachment:


\setupinteraction[state=start]

\starttext

\samplefile{lorem}

\attachment[
   file={hacker.jpg},
   title={Hacker},
   symbol=Paperclip,
   author=Hans,
   location=inmargin,
   reference=foobar,
]

As you can see in \in{attachment}[foobar], we’re hacking away …

\stoptext


Hraban

___________________________________________________________________________________
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

* [NTG-context] Re: (feature proposal) link to attachments: /GoToE
  2023-09-03 14:02     ` Henning Hraban Ramm
@ 2023-09-03 17:23       ` Pablo Rodriguez
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2023-09-03 17:23 UTC (permalink / raw)
  To: ConTeXt users

On 9/3/23 16:02, Henning Hraban Ramm wrote:
> Am 03.09.23 um 13:03 schrieb Pablo Rodriguez:
> [...]
> While I don’t know what’s missing under the hood, I think there’s just a
> “reference” key missing in \attachment or \setupattachment:

Many thanks for your reply, Hraban.

I’m afraid that \in{attachment}[foobar] doesn‘t generate a link in your
sample.

Or do you get a link border from the following source?

  \setupinteraction[state=start]
  \enabledirectives[references.border=green]
  \starttext
  \startTEXpage[offset=1em]

  \attachment[
     file={hacker.jpg},
     method=hidden,
     reference=foobar,
  ]
  \goto{Link to attachment}[foobar]
  \stopTEXpage
  \stoptext

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