NumberFormatException in DOCX->PDF

44 views
Skip to first unread message

George Gastaldi

unread,
Jul 28, 2011, 1:01:48 PM7/28/11
to xdocr...@googlegroups.com
Hello All,

I am facing the following exception when converting a DOCX to PDF. I am using 0.9.0.
The document is attached to this email. Any hint ? 
It seems there is missing a "0x" in the beginning of the parsed string.

The stacktrace is below:

java.lang.NumberFormatException: For input string: "4F81BD"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:458)
at java.lang.Integer.valueOf(Integer.java:528)
at java.lang.Integer.decode(Integer.java:958)
at java.awt.Color.decode(Color.java:707)
at org.apache.poi.xwpf.converter.internal.itext.ColorRegistry.createColor(ColorRegistry.java:43)
at fr.opensagres.xdocreport.itext.extension.color.AbstractColorRegistry.internalCreateColor(AbstractColorRegistry.java:48)
at fr.opensagres.xdocreport.itext.extension.color.AbstractColorRegistry.getColor(AbstractColorRegistry.java:38)
at org.apache.poi.xwpf.converter.internal.itext.StyleEngineForIText.createBorder(StyleEngineForIText.java:249)
at org.apache.poi.xwpf.converter.internal.itext.StyleEngineForIText.buildStyle(StyleEngineForIText.java:278)
at org.apache.poi.xwpf.converter.internal.itext.StyleEngineForIText.startVisitPargraph(StyleEngineForIText.java:305)
at org.apache.poi.xwpf.converter.internal.itext.PDFMapper.startVisitPargraph(PDFMapper.java:219)
at org.apache.poi.xwpf.converter.internal.itext.PDFMapper.startVisitPargraph(PDFMapper.java:101)
at org.apache.poi.xwpf.converter.internal.XWPFElementVisitor.visitParagraph(XWPFElementVisitor.java:168)
at org.apache.poi.xwpf.converter.internal.XWPFElementVisitor.visitBodyElement(XWPFElementVisitor.java:157)
at org.apache.poi.xwpf.converter.internal.XWPFElementVisitor.visitBodyElements(XWPFElementVisitor.java:149)
at org.apache.poi.xwpf.converter.internal.XWPFElementVisitor.visit(XWPFElementVisitor.java:90)
at org.apache.poi.xwpf.converter.itext.XWPF2PDFViaITextConverter.doConvert(XWPF2PDFViaITextConverter.java:54)
DocxProjectWithVelocity.docx

Pascal Leclercq

unread,
Jul 28, 2011, 4:01:18 PM7/28/11
to xdocr...@googlegroups.com
I have a look,

Conversion (to PDF or HTML) is the most tricky part of XdocReport but we think It's a key feature.


thanks for reporting bugs.

2011/7/28 George Gastaldi <gegas...@gmail.com>



--
Pascal Leclercq


Pascal Leclercq

unread,
Jul 28, 2011, 6:03:19 PM7/28/11
to xdocr...@googlegroups.com
Ok,

your analysis was right.

I only have to correct It and we don't have anymore this exception.

I took advantage of your sample to increase the amount of tests we have.

Now we have another issue wich is a bit more tricky : on your template you have put a border on a docx paragraph but there is no equivalent in iText.


For the time being I do not render the border. In the future, I (or we) should have to find a way to render this border by simulating It (using a Table for instance).

As you probably can imagine,  It might be extremely difficult to render exactly the same in the docx and in the PDF.

We try to focus on the 80- 20 

Regards.


2011/7/28 Pascal Leclercq <pascal....@gmail.com>



--
Pascal Leclercq


Pascal Leclercq

unread,
Jul 28, 2011, 6:27:51 PM7/28/11
to xdocr...@googlegroups.com
Artifacts are deployed on :


the artifact that changed is  :<artifactId>org.apache.poi.xwpf.converter</artifactId>




2011/7/29 Pascal Leclercq <pascal....@gmail.com>



--
Pascal Leclercq


Reply all
Reply to author
Forward
0 new messages