dmholte wrote:
> Hi Bruno, the variable String HospNote contains the original html.
The answer is very simple (explained in chapter 6 of the book),
but I have some additional remarks:
> writer.setPageEvent(new ParseBuildPdf());
Using an event to add header/footers is good.
> HeaderFooter header = new HeaderFooter(headerPhrase,false);
Using the HeaderFooter class is no longer supported!
> ArrayList p = HTMLWorker.parseToList(new
> StringReader(HospNote),null);
> for (int k=0;k<p.size(); ++k)
> document.add((Element)p.get(k)); //step 4 adding
> content- the note
Replace the above with:
Element e;
for (int k=0;k<p.size(); ++k) {
e = (Element)p.get(k);
if (e instanceof PdfPTable) {
((PdfPTable)e).setSplitLate(false);
}
document.add(e);
}
What is all this:
> baos.writeTo(fo);
You didn't write anything to baos AND fo should already be closed by
document.close();
Moreover: YOU SHOULD NEVER ADD EXTRA BYTES to a PDF document!!!
All this should be unnecessary:
> try {fo.flush();}catch(Exception e){;}
> try {fo.close();}catch(Exception e){;}
> try {baos.close();}catch(Exception e){;}
> fo = null;
> baos = null;
br,
Bruno
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/