Hi  ,

I am trying to convert the HTML file to PDF

When I am trying to parse the html file using the  following code

  PdfWriter.getInstance(document, new FileOutputStream(pdf));
  SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
  InputSource in = new InputSource(new FileInputStream(html));
  parser.parse(in, this);


I keep getting the following exception

java.util.EmptyStackException
        at java.util.Stack.peek(Stack.java:94)
        at java.util.Stack.pop(Stack.java:76)
        at FoobarFlyer.endElement(FoobarFlyer.java:218)
        at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unk
nown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at FoobarFlyer.<init>(FoobarFlyer.java:114)
        at FoobarFlyer.main(FoobarFlyer.java:380)

This is due to the nested <ol>

<html>
<body>
<ol>
    <li>
        <p><b>Scope of Communications we will Provide in Electronic
Form.</b> We will provide the following information (Electronic
Communications) to you in electronic form:</p>
        <ol>
            <li><p> hello 4444444444444</p> </li>
            <li><p> hell0 5555555555555</p> </li>
            <li><p> hell0 6666666666666</p> </li>
        </ol>
    </li>
    <li> hello 11111111111111</li>
    <li> hello 22222222222222</li>
    <li> hello 33333333333333</li>
</ol>

</body>
</html>


Can any one let me know how the problem can be resolved


Thanks in advance

nagendra
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to