Skip to main content
May 17, 2012
Question

FileAttachment PdfMark in Postscript

  • May 17, 2012
  • 1 reply
  • 6577 views

Does anyone know how to use FileAttachment property to attach a file in postscript please?

eg. to add document properties you would use:

[ /Title (Your Document Title Here)

/Author (Your Name Here)

/Subject (Your Subject Here)

/Keywords (any keywords you like)

/Creator (Adobe Pdf)

/Custom (Custom Contents)

/AndSoOn (And so on ...)

/AndSoForth (And so forth ...)

/DOCINFO pdfmark

This topic has been closed for replies.

1 reply

Mr__Horton
Inspiring
May 17, 2012

I use pdfmarks in PostScript files to accomplish interactivity in the distilled PDF file, so I might be able to help if I understood your question better.

Please explain in more detail, what you want to accomplish.

May 18, 2012

Thanks for your reply. More infomation below:

I have a VBA tool that writes and adds .eps image files (containing PdfMark text) to Powerpoint 2003, so that when printed using a pdf printer such as Pdf995 or Pdfill (which print via a postscript process) they produce clickable interactive pdfs. So hyperlinks (LNK pdfmark), Java GoForward (ANN pdfmark) and Java GoBack (ANN pdfmark) work. I'm also adding Document Properties (DOCINFO pdfmark) and Bookmarks (OUT pdfmark).

If it's technically possible I'd link to add File attachments, such as other pdfs, excel files etc. to the final pdf.  I've tried inserting an .eps file into powerpoint containing the code below which results in the error message:

"Adobe Reader could not open 'test.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 72 72
%%Creator: PDFMark
%%Title: AttachFILE PDFMark
%%BeginProlog
/pdfmark where
{pop} {userdict /pdfmark /cleartomark load put} ifelse
%%EndProlog


/F (c:test.pdf) def
[/_objdef {mstream} /type /stream /OBJ pdfmark
[{mstream} F /PUT pdfmark
[{mstream} << /Type /EmbeddedFile >> /PUT pdfmark

[/_objdef {mfs} /type /dict /OBJ pdfmark
[{mfs} << /Type /Filespec >> /PUT pdfmark
[{mfs} << /F (c:test.pdf) >> /PUT pdfmark
[{mfs} << /EF << /F {mstream} >> >> /PUT pdfmark

[ /Rect [ 216 503 361 612 ]
/Type /Annot
/Subtype /FileAttachment
/FS {mfs}
/ANN pdfmark

%%EOF

So I'm wondering if it is technically possible, or if there is something wrong with the PdfMark?

Thanks,
Steve

Mr__Horton
Inspiring
May 18, 2012

Try using the "Embedded File Content (EMBED) pdfmark method as described in the Adobe Acrobat 7.0.5 pdfmark Reference Manual beginning on page 37:

-----------------------------------------------------------

"

Embedded File Content (EMBED)

With Distiller 6.0, the pdfmark feature EMBED enables the embedding of file content into a PDF document. The syntax for this feature is:

[/Name (Unicode Name)

/FS << /Type /Filespec /F (name) /EF << /F {streamName} >> >>

EMBED pdfmark

Basic pdfmark Features

Building an Output Intents Array

2

38 pdfmark Reference Manual

This use of this feature embeds file content into a name tree within the EmbeddedFiles dictionary of the name dictionary (Names, a collection of name trees). This corresponds to the following structure as found in PDF documents:

<</Type /Catalog% The catalog dictionary

/Names% The name dictionary; see PDF 1.4, p. 92

<</EmbeddedFiles% One particular name tree; see p. 93, 101-102

<</Names% The name tree node; p. 102

[

(Unicode Name)% Unique Unicode string used for Acrobat access

<<% The file specification dictionary; p. 122

/F (name)% The file name for export

/EF << ... >>% Embedded file stream dictionary; p. 124

>>

]

>>

>>

>>

For example:

[/NamespacePush pdfmark

[/_objdef {fstream} /type /stream /OBJ pdfmark

[{fstream} << /Type /EmbeddedFile >> /PUT pdfmark

[{fstream} (Simulating file content here) /PUT pdfmark

[/Name (Unicode Unique Name)% e.g., <feff 0041 0073> is Unicode for “As”

/FS<<

/Type /Filespec

/F (myfile.txt)

/EF << /F {fstream} >>

>>

/EMBED pdfmark

[{fstream} /CLOSE pdfmark

[/NamespacePop pdfmark

"

--------------------------------------------