1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-10 18:00:11 +01:00

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.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
@ -434,7 +435,7 @@ public class PdfUtils {
.build(); .build();
} }
public static PDDocument setMetadataToPdf(PDDocument pdf, PdfMetadata pdfMetadata) { public static void setMetadataToPdf(PDDocument pdf, PdfMetadata pdfMetadata) {
pdf.getDocumentInformation().setAuthor(pdfMetadata.getAuthor()); pdf.getDocumentInformation().setAuthor(pdfMetadata.getAuthor());
pdf.getDocumentInformation().setProducer(pdfMetadata.getProducer()); pdf.getDocumentInformation().setProducer(pdfMetadata.getProducer());
pdf.getDocumentInformation().setTitle(pdfMetadata.getTitle()); pdf.getDocumentInformation().setTitle(pdfMetadata.getTitle());
@ -442,8 +443,6 @@ public class PdfUtils {
pdf.getDocumentInformation().setSubject(pdfMetadata.getSubject()); pdf.getDocumentInformation().setSubject(pdfMetadata.getSubject());
pdf.getDocumentInformation().setKeywords(pdfMetadata.getKeywords()); pdf.getDocumentInformation().setKeywords(pdfMetadata.getKeywords());
pdf.getDocumentInformation().setCreationDate(pdfMetadata.getCreationDate()); pdf.getDocumentInformation().setCreationDate(pdfMetadata.getCreationDate());
pdf.getDocumentInformation().setModificationDate(pdfMetadata.getModificationDate()); pdf.getDocumentInformation().setModificationDate(Calendar.getInstance());
return pdf;
} }
} }