Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Jul 20, 2020 1:09 pm

Hi

I can easily add XMP meta data to my PDFs with the following C# Code:

Code: Select all
PdfDocument doc = new PdfDocument(PdfConformanceLevel.Pdf_A1A);
doc.FileInfo.Version = PdfVersion.Version1_7;
XmpMetadata meta = doc.XmpMetaData;
meta.SetCustomProperty("CustomProp", "TestEntry");
doc.SaveToFile("D:\\Test_CSharp.pdf");

doc = new PdfDocument("D:\\Test_CSharp.pdf");
File.WriteAllText("D:\\Test_CSharp.txt", doc.XmpMetaData.GetCustomProperty("CustomProp"));
doc.Close();


It generates a PDF with the XMP data and I can read back these values.
I can also inspect the PDF with an editor and find the CustomProp:

CSharp.png


But I need to do this with Java and it doesn't work:

Code: Select all
PdfDocument doc = new PdfDocument(PdfConformanceLevel.Pdf_A_1_A);
doc.getFileInfo().setVersion(PdfVersion.Version_1_7);
XmpMetadata meta = doc.getXmpMetaData();
meta.setCustomProperty("CustomProp", "TestEntry");
doc.saveToFile("D:\\Test_Java.pdf");
      
doc = new PdfDocument("D:\\Test_Java.pdf");
try {
    Files.write(Paths.get("D:\\Test_Java.txt"), doc.getXmpMetaData().getCustomProperty("CustomProp").getBytes(),
            StandardOpenOption.CREATE, StandardOpenOption.WRITE);
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
doc.close();


It generates a PDF with the CustomProp but the CustomProp has no value, which can also be seen in the editor:
Java.png


Also, I cannot read back the value (because it doesn't exist in the PDF, of course).

I am using the latest release 3.7.4.
Can you please provide a hotfix or tell me what I'm doing wrong?
We desperately need custom XMP meta data.

Thank you in advance.

RicoScheller
 
Posts: 35
Joined: Tue Jul 02, 2019 10:34 am

Tue Jul 21, 2020 9:53 am

Hello,

Thanks for your message.
I indeed reproduced the behavior you mentioned when testing with our Spire.PDF for Java. This issue has been logged into our bug tracking system with the ticket SPIREPDF-3442. Our Dev team will further investigate and fix it. Once it is fixed, we will provide the hotfix version for you. Sorry for the inconvenience caused.

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Wed Aug 05, 2020 2:08 pm

Hey

How is it looking?
Is there a target release date for this fix?
Do I somehow have access to the bug tracking system?

Thanks for your information.

RicoScheller
 
Posts: 35
Joined: Tue Jul 02, 2019 10:34 am

Thu Aug 06, 2020 2:01 am

Hello,

I got the news from our Dev team that your issue has been solved. Now it is in the testing phase. Once the tests pass, we will provide the hotfix version for you ASAP.Thanks for your patience.

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Fri Aug 14, 2020 6:57 am

Hey

I just wanted to say thanks for your good support.
The new version now correctly writes XMP meta data.

I'm happy :wink:

RicoScheller
 
Posts: 35
Joined: Tue Jul 02, 2019 10:34 am

Fri Aug 14, 2020 11:11 am

Hello,

Thanks for your quick response.
I’m glad to hear that the latest version( Spire.PDF for Java Version:3.8.2 ) have fixed your issue. If you encounter any issue related to our product in the future, please feel free to contact us.

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Return to Spire.PDF