Check your HTML, is it valid?
Running it true w3x validator already gave: The following notes and warnings highlight missing or conflicting information which caused the validator to perform some guesswork prior to validation, or other things affecting the output below. If the guess or fallback is incorrect, it could make validation results entirely incoherent. It is highly recommended to check these potential issues, and, if necessary, fix them and re-validate the document.
Validation Output: 3 Errors
On 05/27/2013 03:32 PM, roboboot wrote: I use XMLWorker 5.4.1. and I need to convert HTML to PDF.I have just tried the sample code on the web site of the project to convert an XHTML file with Table inside but I get this error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.get(Unknown Source) at com.itextpdf.tool.xml.html.table.Table.widenLastCell(Table.java:527) at com.itextpdf.tool.xml.html.table.Table.end(Table.java:168) at com.itextpdf.tool.xml.html.AbstractTagProcessor.endElement(AbstractTagProcessor.java:189) at com.itextpdf.tool.xml.pipeline.html.HtmlPipeline.close(HtmlPipeline.java:206) at com.itextpdf.tool.xml.XMLWorker.endElement(XMLWorker.java:141) at com.itextpdf.tool.xml.parser.XMLParser.endElement(XMLParser.java:395) at com.itextpdf.tool.xml.parser.state.ClosingTagState.process(ClosingTagState.java:70) at com.itextpdf.tool.xml.parser.XMLParser.parseWithReader(XMLParser.java:235) at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:213) at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:174) at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:223) at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:185) at Test.main(Test.java:28) The code following: Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream("result.pdf")); document.open(); XMLWorkerHelper.getInstance().parseXHtml(writer, document, new FileInputStream("test.html")); document.close(); Why that? Following the test file 2537.html <http://itext-general.2136553.n4.nabble.com/file/n4658393/2537.html> -- View this message in context: http://itext-general.2136553.n4.nabble.com/XMLWorker-java-lang-ArrayIndexOutOfBoundsException-for-HTML-with-Tables-inside-tp4658393.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net 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 |
------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net 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