Thanks Paulo,
I have something sort of working...
Having trouble getting a list to display correctly in the pdf from the html
string, am I using the style.loadTagStyle("li", "", ""); correctly for html
lists? Not sure how to use this correctly for fonts either? Any suggestions
for the html below.
<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>
Thanks
Mark
-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent: Monday, 21 February 2005 6:01 PM
To: Mark Hitchcock; [email protected]
Subject: RE: [iText-questions] HTMLWorker
You have it right with HTMLWorker. About the rest:
PdfContentByte cb = pdfWriter.getDirectContent();
ColumnText ct = new ColumnText(cb);
ct.setSimpleColumn(...);
ct.setYLine(...);
if (list != null) {
for (int i=0; i < list.size(); i++) {
ct.addElement((Element)list.get(i));
}
}
ct.go();
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark
> Hitchcock
> Sent: Monday, February 21, 2005 6:47 AM
> To: [email protected]
> Subject: [iText-questions] HTMLWorker
>
> Does anyone have an example of HTMLWorker in action. I am struggling
> with how to add elements to the document after they are parsed into an
> ArrayList.
> I have attached some code below and hopefully someone will be able to
> help me work through it or have an existing example.
>
> ****************
>
> 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() - 1; i++) {
> ColumnText ct = new ColumnText(cb);
> ct.addElement();
> ct.go();
> }
> }
>
> document.close();
>
> ****************
>
>
> Thanks
> Mark Hitchcock
>
>
>
>
> -------------------------------------------------------
> 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