You need to use SAXmyHtmlHandler.setControlOpenClose(false), open/close the doc yourself and feed one html page at a time.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Axel Kramer > Sent: Wednesday, February 16, 2005 8:47 PM > To: [email protected] > Subject: [iText-questions] Howtp merge multiple (X)HTML > StringBuffers into one PDF file? > > 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 > ------------------------------------------------------- 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_ide95&alloc_id396&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
