PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: Embed docs in PDF doesn't work
   PostPosted: 14 Apr 2021, 17:29 
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.


  Subject: Re: Embed docs in PDF doesn't work
   PostPosted: 21 Apr 2021, 08:44 
Any idea?



[Reply]     [ 2 posts ] 

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