From 0f367c23aa43e671786c0cfee44cd89459aa5428 Mon Sep 17 00:00:00 2001 From: Dimitris Kaitantzidis <44621809+DimK10@users.noreply.github.com> Date: Mon, 8 Apr 2024 23:53:00 +0300 Subject: [PATCH] 359 split metadata lost (#1049) * Closes #359 * Adds a minor fix, the modified date should be changed after a modification is made. --- src/main/java/stirling/software/SPDF/utils/PdfUtils.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index f51eff2a..24f51c6a 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -6,6 +6,7 @@ import java.awt.image.RenderedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -434,7 +435,7 @@ public class PdfUtils { .build(); } - public static PDDocument setMetadataToPdf(PDDocument pdf, PdfMetadata pdfMetadata) { + public static void setMetadataToPdf(PDDocument pdf, PdfMetadata pdfMetadata) { pdf.getDocumentInformation().setAuthor(pdfMetadata.getAuthor()); pdf.getDocumentInformation().setProducer(pdfMetadata.getProducer()); pdf.getDocumentInformation().setTitle(pdfMetadata.getTitle()); @@ -442,8 +443,6 @@ public class PdfUtils { pdf.getDocumentInformation().setSubject(pdfMetadata.getSubject()); pdf.getDocumentInformation().setKeywords(pdfMetadata.getKeywords()); pdf.getDocumentInformation().setCreationDate(pdfMetadata.getCreationDate()); - pdf.getDocumentInformation().setModificationDate(pdfMetadata.getModificationDate()); - - return pdf; + pdf.getDocumentInformation().setModificationDate(Calendar.getInstance()); } }