HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › Unable to embed document
- This topic has 3 replies, 2 voices, and was last updated Dec 28, 2015
17:05:17 byPD4ML.
-
AuthorPosts
-
December 22, 2015 at 09:17#26856
Hi there,
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:
<pd4ml:attachment description="attached.txt" icon="PushPin"> data:base64,YSxiLGMsZCxlDQp2YWx1ZSAxLCB2YWx1ZSAyLCB2YWx1ZSAzLCB2YWx1ZSA0 </pd4ml:attachment>
What could I be doing wrong?
I can attach a full HTML but I see no option to attach a file.Best regards
MarcusDecember 22, 2015 at 09:34#29364Does the attachment appear in the side bar (“Attachments” tab on the left window side of Acroread)?
December 22, 2015 at 17:46#29365@PD4ML wrote:
Does the attachment appear in the side bar (“Attachments” tab on the left window side of Acroread)?
Hi there,
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.Is there a way of doing this please?
Thank you in advance.
December 28, 2015 at 17:05#29366Normally 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.
For example:
<pd4ml:attachment icon="PushPin"> data:text/plain;base64,YSxiLGMsZCxlDQp2YWx1ZSAxLCB2YWx1ZSAyLCB2YWx1ZSAzLCB2YWx1ZSA0 </pd4ml:attachment>
auto-names the attachment as “attachment.txt”
-
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.
