At 16:22 10/07/2003 +0200, you wrote:

\setupinteraction[state=start]

\useattachment[whatever][test1.txt]

\definesymbol
   [ObjectNumber]
   [object number \PDFattachmentnumber]

\setupattachments[symbol={ObjectNumber}]

\starttext \attachment[whatever] \stoptext
---

gives "object number 7" written in the PDF file, but the
object that contains the _real_ data stream is object 6, not 7:
6 0 obj <<
/Length 20
>>
stream
Das ist Testdatei 1
endstream
endobj
7 0 obj
<< /Type /Filespec /F (test1.txt) /EF <</F 6 0 R>> >>
endobj

thus, in order to get the correct obj number for pdftosrc one
need the number of the stream-object.

hm, pdftosrc should probably accept both as valid numbers (i.e. in case of no 7 resolve it to 6), so if there's someone out there willing to patch ...


another thing that might be useful is that \PDFattachmentnumber
should read the attachment name as argument and return the obj-number.

the above symbol could then be defined as:
\definesymbol
   [ObjectNumber]
   [object number \PDFattachmentnumber[\currentattachment]]

_and_ one can use it inside the text:

\starttext
This PDF-document has the file test1.txt attached. Users of pdftosrc
can extract the PDF-object \PDFattachmentnumber[whatever] to
get the file.
\stoptext

this is kind of tricky, since we're never sure if forward or backward referencing takes place (apart form the fact that this kind of trickery can seldom b eimplemented in a clean way). Anyhow, since i happen to be doing things with attachments currently you're lucky; i made you:


\starttext

\definesymbol
  [ObjectNumber]
% [object number {\PDFattachmentnumber[xx]}]
  [object number \PDFattachmentnumber]

\useattachment[test][xx][test.tex]
\setupattachments[symbol=ObjectNumber]
\attachment[test]

\stoptext

(in case of just two args, i.e. no [xx], you need to feed the filename, i.e. test.txt)

I'll send you the patched spec file (keep in mind that this \PDFattachmentnumber is some driver functionality, and not something of teh core).

Hans
-------------------------------------------------------------------------
                                  Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                       information: http://www.pragma-ade.com/roadmap.pdf
                    documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

_______________________________________________
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to