Thanks for the reply Paulo however I am still struggling with how to
actually add the elements to the document after they are parsed into an
ArrayList.  I have attached some code below and hopefully you will be able
to help me work through it or if you have an example I think a number of
other people and newbie's like myself would really benefit from it.

****************

Document document = new Document();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter pdfWriter = PdfWriter.getInstance(document, baos);

document.open();

StyleSheet style = new StyleSheet();
style.loadTagStyle("li", "", "");
style.loadTagStyle("p", "", "");
StringReader sr = new StringReader(html_field_from_db);
ArrayList list = HTMLWorker.parseToList(sr, style);
           
PdfContentByte cb = pdfWriter.getDirectContent();
            
if (list != null) {
  for (int i=0; i < list.size(); i++) {
    ColumnText ct = new ColumnText(cb);
    ct.addElement();
    ct.go();
  }
}

document.close();

****************

Thanks in advance
Mark 

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 16 February 2005 5:57 PM
To: Mark Hitchcock; [email protected]
Subject: RE: [iText-questions] htmlParser

You want HTMLWorker. Search the mailing list for that name. 

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark 
> Hitchcock
> Sent: Wednesday, February 16, 2005 8:05 AM
> To: [email protected]
> Subject: [iText-questions] htmlParser
> 
> Hi,
> 
> Just a quick question about the htmlParser.  I have a document that I 
> am creating which is talking to a database to retrieve a number of 
> strings.
> One of the strings I am receiving contain a number of html tags.  If 
> there a way that I can parse the String from the database and add it 
> to my document?
> 
> The html is fairly basic, i.e. 
> 
> <font face="Arial" size="10" color="#15325C"> <p>A paragraph.</p> 
> <li>List item.</li> <li>List item.</li> <li>List item.</li> <p>Another 
> paragram.</p> </font>
> 
> As you can see there are no start/ending html tags and the majority of 
> the strings would not be much more complicated.
> 
> I have looked at the HtmlParser however I think that it wants a file 
> name as a string rather than a String of characters to Parse.
> 
> Any help is much appreciated.
> 
> Cheers
> 
> Mark Hitchcock
> Analyst Programmer (Software Systems)
> [EMAIL PROTECTED]
> 
> 
> 
> -------------------------------------------------------
> 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_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