Skip to content
Advertisement

iText Border.getWidth()’ on a null object reference

I’m Using iText to create a PDF in an android app which is running on an android 7 device.

My input is a xml-file with some information which is displayed on the pdf. In some constellation of the xml-content I’m getting the following exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'float com.itextpdf.layout.border.Border.getWidth()' on a null object reference
at com.itextpdf.layout.renderer.TableRenderer.drawBorders(TableRenderer.java:736)
at com.itextpdf.layout.renderer.TableRenderer.drawChildren(TableRenderer.java:562)
at com.itextpdf.layout.renderer.AbstractRenderer.draw(AbstractRenderer.java:314)
at com.itextpdf.layout.renderer.TableRenderer.draw(TableRenderer.java:489)
at com.itextpdf.layout.renderer.DocumentRenderer.flushSingleRenderer(DocumentRenderer.java:118)
at com.itextpdf.layout.renderer.RootRenderer.flush(RootRenderer.java:156)
at com.itextpdf.layout.Document.close(Document.java:114)

I’m not able to recreate this Error in my IDE, the exact same xml is running perfectly on my computer.

Also the strange part is, that I dont use borders in the area where the trouble causing content of the xml is displayed. Also im not using this method: com.itextpdf.layout.border.Border.getWidth()

So in my opinion it has to be an issue of iText in combination with android or I’m using it wrong.

I know thats not a lot of usefull information, but it’s all i got..

Advertisement

Answer

The problem was a bug in the used iText version(7.0.0). This doesn’t occure with a more recent version (7.1.14).

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement