I am trying to embed a document within generated PDF file but the only thing I am getting is an icon but there is no option to click on the icon and open embedded document. I have literally Copied-Pasted your code example like this:
Does the attachment appear in the side bar (“Attachments” tab on the left window side of Acroread)?
I had to rewrite the whole thing and that little icon is now appearing but it is still not working correctly.
If I am displaying contents of a text file and set description=”FileAttachment.txt” then I can open text file attachments by clicking a little icon in generated PDF, great. However, when I try to attach and open a Word Document I am getting the following error message:
“This file does not have a program associated with it for performing this action. Please install…”.
When I update description=”Fileattachment.docx” then I can open Word documents only. This will not work of course as business users can attach any type of file so description=”FileAttachment.attachmenttype” must be dynamically generated to reflect attached file extension.
Normally PD4ML extracts a file name from attachments URL. In your case an attachment body is passed as a base64-encoded stream of bytes with no file name hint – in such situation a description attribute with a file name is needed.
In the forthcoming v398fx3 we implemented an “auto-guess” of file extension by a mime type. If there is no description, it will extract a mime type from “data:” prefix.