PDF Generating Tool Support Forum

HOME   Login   Register    Search




Post a reply
Username:
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are OFF
Disable BBCode
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the Board Administrator.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - Embed docs in PDF doesn't work
Post subject:  Re: Embed docs in PDF doesn't work
Any idea?
    Post Posted: 21 Apr 2021, 08:44
 
Post subject:  Embed docs in PDF doesn't work
Team,



I am trying to embed multiple documents within PDF generated. I couldn't succeed so far. Below are the steps that i tried.



1. I have written the java code



try{
com.pd4ml.PD4ML pd4ml = new com.pd4ml.PD4ML();
String html = "<html><body>Test</body></html>";
java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(html.getBytes());
// read and parse HTML
pd4ml.injectHtml("<div style=\"text-align: right; width: 100%\" >"
+ "<pd4ml:attachment style=\"align: right\" description=\"Check\" type=\"paperclip\" src=\"http://pd4ml.com/i/logo.png\" icon=\"Area\" alt=\"Base64 encoded image\" width=\"15\" height=\"15\" style=\"border: 1 solid tomato\"/>"
+ "</div>", true);
pd4ml.readHTML(bais);
java.io.File pdf = java.io.File.createTempFile("result", ".pdf");
java.io.FileOutputStream fos = new java.io.FileOutputStream(pdf);
pd4ml.writePDF(fos);
java.awt.Desktop Desktop = java.awt.Desktop.getDesktop();
Desktop.open(pdf);
} catch (Exception e) {
e.printStackTrace();
};



I am getting the text "Test" and a paperclip image...But nothing happens when i move the mouse over/click on it......



2. When i use the below type of input



<pd4ml:attachment src="data:image/gif;base64,R0lGODlhDwAPAKECAAAAzMzM/////



wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4ML



wWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw=="

description="attachment sample"
icon="Area" alt="Base64 encoded image" width="15" height="15"
style="border: 1 solid tomato"/>



I am able to see icon, and when moving the mouse over getting the pop-up of file name, when i click to open it, saying that attachment can't be opened.



Really not sure what i need to do here...Please support.
    Post Posted: 14 Apr 2021, 17:29
 


cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share