359 split metadata lost (#1049)

* Closes #359

* Adds a minor fix, the modified date should be changed after a modification is made.
This commit is contained in:
Dimitris Kaitantzidis 2024-04-08 23:53:00 +03:00 committed by GitHub
parent 7dd1679588
commit 0f367c23aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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());
}
}