Forum How do I...?

PDF Attachments

cbourne
Is it possible to add attachments to PDF documents created with Prince? e.g. Adobe Acrobat can import and include attachments within PDF documents.

Regards,

Carl
mikeday
Prince doesn't have a facility for adding file attachments to generated PDF documents at this time, although it might be possible to add this feature.
cbourne
Mike,

Is this a roadmap item or something we would need to request specifically?

Carl
mikeday
It's not on the roadmap at the moment as no one has ever asked for it. Was there a particular use case that you had in mind?
edwin.vlieg
+1 for adding PDF attachment support

Our use case: we are generating PDF invoices for our clients. These invoices need to be processed by other software, so we want to include an XML representation of the invoice for machine readability. Adding this XML document to the invoice as an attachment would be a nice solution.
cbourne
Mike,

Our use case relates to an application for which we are exploring the use of PrinceXML to automate the secure delivery of documents. We would like to use Prince to create an encrypted PDF which would contain any number of other documents. The ability to specify attachements on the command line would be superb!

e.g.

prince -a attachment.xls -a attachment.doc

Regards,

Carl
mikeday
I think we can do this, perhaps we can put a quick prototype together over the weekend. :D
cbourne
Mike,

If thats possible, it would be great! I'm more than happy to do some testing for you.

Carl
mikeday
Prince 8.0 supports PDF attachments with the --attach=FILE command-line option.
jim_albright
can I attach all files in a folder like
--attach=audio/*.wav

Jim Albright
Wycliffe Bible Translators

mikeday
No, on Windows this will try to attach a single file called "audio/*.wav" and on Linux it will try to attach a file called "audio/foo.wav audio/bar.wav ..." due to shell expansion. At the moment you need one --attach argument per file.
jim_albright
So my real request is go embed audio files just like graphic files are embedded.

I don't want to have to keep track of a bunch of small files.
A dictionary has the potential of one audio file per entry giving the proper pronunciation of the entry.

Jim Albright

Jim Albright
Wycliffe Bible Translators

mikeday
Okay this is a different issue, basically requires putting a link to the audio file in the document, eg. with an icon or something, and Prince converting that link into an embedded click-to-play audio clip. We can't do this yet, though.
Reading
Just wondering if Prince is able to add attachments do pdfs now? So people can download a file straight from the pdf.
mikeday
Not with links from within the page, no. Attached files can be accessed from the attachments panel, though.
taku_chin
So is adding attachments only done strictly via the command line?
mikeday
There is also a JavaScript API:
PDF.attachFile("data.xls", "Latest sales figures.");
taku_chin
Is there something similar in the Java API?
mikeday
No actually, but you can call setOptions() to pass additional arbitrary command-line arguments.