Hi Jason,

On 29 November 2011 16:24, Jason Berk <[email protected]> wrote:

> I have an html file with contents:
>
> <html>
> <body>
> <p>
>        <b>this is bold</b></br>
>        This is not in bold
> </p>
> </body>
> </html>
>
> When I run XmlWorker I get this exception:
> Exception in thread "main"
> com.itextpdf.tool.xml.exceptions.RuntimeWorkerException: Invalid nested
> tag br found, expected closing tag p.
>
> public TestHTMLWorker() throws Exception {
>                Document document = new Document();
>                PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream(
>                                "/home/jberk/desktop/HTMLtoPDF.pdf"));
>                writer.setInitialLeading(12);
>                document.open();
>                XMLWorkerHelper.getInstance().parseXHtml(writer,
> document,
>                                new FileReader(PROJECT_DIR +
> "/test.html"));
>                document.close();
>        }
>
> If I change "</br>" to "<br></br>" it works.
>

Well, that's a correct behaviour, isn't it?
You have a closing br tag, without the corresponding opening one: the XML
file is not valid, I would expect XmlWorker to throw an Exception then.

Aren't you mistaking with a self-closing br tag (i.e. <br/>) ?

Cheers,
alexis
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to