Skip to content

Commit

Permalink
final touches
Browse files Browse the repository at this point in the history
Signed-off-by: a <a>
  • Loading branch information
a committed Sep 13, 2024
1 parent ba44f0f commit ed43e5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/main/java/stirling/software/SPDF/config/PdfMetadataService.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ private void setMetadataToPdfInstance(
}

private void setNewDocumentMetadata(PDDocument pdf, PdfMetadata pdfMetadata) {
String producer = "Stirling-PDF";

String title = pdfMetadata.getTitle();
String creator = "Stirling-PDF";

if (applicationProperties
.getEnterpriseEdition()
.getCustomMetadata()
.isAutoUpdateMetadata()) {
// if (applicationProperties
// .getEnterpriseEdition()
// .getCustomMetadata()
// .isAutoUpdateMetadata()) {

// producer =
//
Expand All @@ -104,20 +104,21 @@ private void setNewDocumentMetadata(PDDocument pdf, PdfMetadata pdfMetadata) {
// applicationProperties.getEnterpriseEdition().getCustomMetadata().getCreator();
// title = applicationProperties.getEnterpriseEdition().getCustomMetadata().getTitle();

if ("{filename}".equals(title)) {
title = "Filename"; // Replace with actual filename logic
} else if ("{unchanged}".equals(title)) {
title = pdfMetadata.getTitle(); // Keep the original title
}
}
// if ("{filename}".equals(title)) {
// title = "Filename"; // Replace with actual filename logic
// } else if ("{unchanged}".equals(title)) {
// title = pdfMetadata.getTitle(); // Keep the original title
// }
// }

pdf.getDocumentInformation().setProducer(producer + " " + appVersion);
pdf.getDocumentInformation().setTitle(title);
pdf.getDocumentInformation().setCreator(creator + " " + appVersion);
pdf.getDocumentInformation().setCreationDate(Calendar.getInstance());
}

private void setCommonMetadata(PDDocument pdf, PdfMetadata pdfMetadata) {
String producer = "Stirling-PDF";
pdf.getDocumentInformation().setProducer(producer + " " + appVersion);
pdf.getDocumentInformation().setSubject(pdfMetadata.getSubject());
pdf.getDocumentInformation().setKeywords(pdfMetadata.getKeywords());
pdf.getDocumentInformation().setModificationDate(Calendar.getInstance());
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/settings.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ EnterpriseEdition:
legal:
termsAndConditions: '' # URL to the terms and conditions of your application (e.g. https://example.com/terms) Empty string to disable or filename to load from local file in static folder
privacyPolicy: '' # URL to the privacy policy of your application (e.g. https://example.com/privacy) Empty string to disable or filename to load from local file in static folder
accessibilityStatement: '' # URL to the accessibility statement of your application (e.g. https://example.com/accessibility) Empty string to disable or filename to load from local file in static folder
cookiePolicy: '' # URL to the cookie policy of your application (e.g. https://example.com/cookie) Empty string to disable or filename to load from local file in static folder
impressum: '' # URL to the impressum of your application (e.g. https://example.com/impressum) Empty string to disable or filename to load from local file in static folder

system:
defaultLocale: en-US # Set the default language (e.g. 'de-DE', 'fr-FR', etc)
Expand Down

0 comments on commit ed43e5c

Please sign in to comment.