Hello!
Please advise if it's possible to edit XMP metadata in an existing PDF file? I've found a solution for Spire.PDF for .NET but what about Java?
We are using Spire.PDF for Java v9.2.5
Thank you.
PdfDocument doc = new PdfDocument();
doc.loadFromFile("test.pdf");
doc.getDocumentInformation().setAuthor("E-iceblue");
doc.getDocumentInformation().setCreator("Spire.PDF");
doc.getDocumentInformation().setCustomProperty("Field", "NewValue");
doc.getDocumentInformation().setKeywords("XMP");
doc.getDocumentInformation().setProducer("E-icenlue Co,.Ltd");
doc.getDocumentInformation().setSubject("XMP Metadata");
doc.getDocumentInformation().setTitle("Set XMP Metadata in PDF");
doc.saveToFile("result.pdf");
Annika.Zhou wrote:Hello,
Thank you for your inquiry.
Please use the following code to implement your requirements.
- Code: Select all
PdfDocument doc = new PdfDocument();
doc.loadFromFile("test.pdf");
doc.getDocumentInformation().setAuthor("E-iceblue");
doc.getDocumentInformation().setCreator("Spire.PDF");
doc.getDocumentInformation().setCustomProperty("Field", "NewValue");
doc.getDocumentInformation().setKeywords("XMP");
doc.getDocumentInformation().setProducer("E-icenlue Co,.Ltd");
doc.getDocumentInformation().setSubject("XMP Metadata");
doc.getDocumentInformation().setTitle("Set XMP Metadata in PDF");
doc.saveToFile("result.pdf");
Best regards,
Annika
E-iceblue support team