Hi

For the Wikipedia Eclipse Plugin at
http://www.plog4u.org, I would like to create a simple
PDF export function. 
Internally I create complete (X)HTML documents one
after the other in a StringBuffer.
In a method called appendArticle() I add these HTML
buffers to the pdf file. 
This only works for the first HTML buffer.
How can I merge multiple HTML buffers in one PDF
document. 
Does someone has an example? 


Pseudocode:
...
FileOutputStream os = null;
String pdffilename = fPath.toString();
os = new FileOutputStream(pdffilename);
Document document = new Document(PageSize.A4);
PdfWriter pdfWriter = PdfWriter.getInstance(document,
os);
document.open();
document.resetPageCount();
...

..
forall selected wikipedia files
  convertToHTML();
  apendArticle();
...


private void appendArticle(FileOutputStream os,
StringBuffer htmlBuffer) {
    StringReader stream = null;
    try {
      HtmlParser parser = new HtmlParser();
      stream = new
StringReader(htmlBuffer.toString());
      parser.go(document, stream);
    } catch (Exception e) {
      addError("PDF export exception", e);
    } finally {
      if (stream != null) {
        stream.close();
      }
    }
  }

-- 
Axel Kramer


        

        
                
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: 
http://mail.yahoo.de


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to