openhtmltopdf icon indicating copy to clipboard operation
openhtmltopdf copied to clipboard

uncaught NPE when rendering image submit button in form component

Open robchallen opened this issue 2 years ago • 0 comments

When rendering: https://www.w3.org/People/mimasa/test/xhtml/media-types/test.html

The PdfBoxPerDocumentFormState.getControlFont method throws a null pointer exception due to a null font in: ctrl.box.getStyle().getFontSpecification()

The null font is caused by the image submit button element:

[alt="Submit", id="input.image", name="input.image", src="dot.png", style="width: 20px; height: 20px", title="Image submit button", type="image"]

Thread [main] (Suspended (breakpoint at line 99 in PdfBoxPerDocumentFormState)) PdfBoxPerDocumentFormState.getControlFont(SharedContext, PdfBoxForm$Control) line: 99 PdfBoxPerDocumentFormState.processControls(SharedContext, PDDocument, Box) line: 149 PdfBoxFastOutputDevice.processControls() line: 299 PdfBoxFastOutputDevice.finish(RenderingContext, Box) line: 904 PdfBoxRenderer.writePDFFast(List<PageBox>, RenderingContext, Rectangle2D, PDDocument) line: 674 PdfBoxRenderer.createPdfFast(boolean, int) line: 564 PdfBoxRenderer.createPDF(OutputStream, boolean, int) line: 490 PdfBoxRenderer.createPDFWithoutClosing() line: 417

robchallen avatar May 02 '22 22:05 robchallen