PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: HTML-styled String to pdf using streams
   PostPosted: 05 Nov 2010, 01:04 
Hi, I am trying to convert a HTML-styled String (for instance: "<HTML><BODY>my text to show</body><html>) to a pdf using streams:

StringReader isr2 = new StringReader(myhtmlstringl);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
pd4ml.render(isr2, baos);
if I use a fieoutputstream, the pdf is created but show a blank page.
and if I use the bytearrayoutputstream, what can I do for show the pdf-result in my webpage.


Attachments:
myconverter.txt [1.41 KiB]
Downloaded 141 times
  Subject: Re: HTML-styled String to pdf using streams
   PostPosted: 09 Nov 2010, 13:18 
Among PD4ML examples http://pd4ml.com/examples.zip there is PD4MLBySslServlet.java class, which ilustrates how to use PD4ML in web scenarios (just ignore SSL stuff there).

At first glance your Java code seems to be correct. So I would suspect source HTML as a reason of blank PDFs. Do you really have opening <html> tag at the end of your HTML code? Please try to remove it - it may confuse the HTML parser.



[Reply]     [ 2 posts ] 

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