danfickle / danfickle/openhtmltopdf

Provide custom PDDocumentInformation

Open
#660 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

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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.