danfickle / danfickle/openhtmltopdf

uncaught NPE when rendering image submit button in form component

Open
#834 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

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, RenderingContext, Rectangle2D, PDDocument) line: 674
PdfBoxRenderer.createPdfFast(boolean, int) line: 564
PdfBoxRenderer.createPDF(OutputStream, boolean, int) line: 490
PdfBoxRenderer.createPDFWithoutClosing() line: 417

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.