Skip to content
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