Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing pdf PDDocumentInformation should not be removed #679

Open
wants to merge 1 commit into
base: open-dev-v1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -873,23 +873,25 @@ private XMPSchema createPdfaProperty(String category, String description, String

// Sets the document information dictionary values from html metadata
private void setDidValues(PDDocument doc) {
PDDocumentInformation info = new PDDocumentInformation();

info.setCreationDate(Calendar.getInstance());
if(doc.getDocumentInformation() == null) {
doc.setDocumentInformation(new PDDocumentInformation());
}
final PDDocumentInformation info = doc.getDocumentInformation();

if (_producer == null) {
info.setProducer("openhtmltopdf.com");
} else {
info.setProducer(_producer);
if(info.getCreationDate() == null) {
info.setCreationDate(Calendar.getInstance());
}
if(info.getProducer() == null) {
info.setProducer(_producer == null ? "openhtmltopdf.com": _producer);
}

for (Metadata metadata : _outputDevice.getMetadata()) {
String name = metadata.getName();
if (name.isEmpty())
continue;
String content = metadata.getContent();
if( content == null )
continue;
String name = metadata.getName();
if (name.isEmpty())
continue;
String content = metadata.getContent();
if( content == null )
continue;
if( name.equals("title"))
info.setTitle(content);
else if( name.equals("author"))
Expand All @@ -901,8 +903,6 @@ else if(name.equals("keywords"))
else
info.setCustomMetadataValue(name,content);
}

doc.setDocumentInformation(info);
}

private void paintPageFast(RenderingContext c, PageBox page, DisplayListPageContainer pageOperations, int additionalTranslateX) {
Expand Down