danfickle / danfickle/openhtmltopdf
Provide custom PDDocumentInformation
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
You can set a custom instance of PDDocument to PdfRendererBuilder calling #usePDDocument() method.
On PDDocument you can set a custom instance of PDDocumentInformation by calling #setDocumentInformation() method.
Right now this custom instance will never taken into account while document rendering phase.
The reason can be found in PdfBoxRenderer#setDidValues() method.
Here PDDocumentInformation will be freshly instantiated anytime, instead of checking, if the provided PDDocument instance already provides an instance of PDDocumentInformation.
https://github.com/danfickle/openhtmltopdf/blob/openhtmltopdf-parent-1.0.6/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxRenderer.java#L846
In the future it should be only instantiated and filled automatically via document metadata, if doc.getDocumentInformation() is null or doc.getDocumentInformation().getCOSObject().items is 0. If a valid PDDocumentInformation is already available, the doc instance will not be updated.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.