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.

Thu Jul 31, 2025 8:34 am

Hello ,

We are using spire pdf for java (11.7.0) to generate factur X document.

One requirement is to have included XMP entries with a specific namespace ant schema URI .

We succesfully registered xmp namespace using PdfXmpNamespace.registerNamespace(String,String)
We succesfully added XMP Metadata Using PdfXmpMetadata.setPropertyString methods

As the associated schema is not an included schema we need to also add it to the document

We didn't find any method to register the schema content inside the XMP

How can we register the schema ?

ghenry_talentia
 
Posts: 8
Joined: Fri Jul 11, 2025 1:36 pm

Thu Jul 31, 2025 10:08 am

Hello,

Thank you for your inquiry.
Could you please provide us with a complete runnable code demo, your pdf files and your xml files? This information will help us investigate your issue more accurately and offer an effective solution. It would be better if you could provide some screenshots illustrating the issue you're currently encountering.
You may upload the files as attachments or send them directly to my email: [email protected]. Thanks in advance.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Fri Aug 01, 2025 12:02 pm

Hello
Working Poc attached
Also example for the extension schema

ghenry_talentia
 
Posts: 8
Joined: Fri Jul 11, 2025 1:36 pm

Mon Aug 04, 2025 7:45 am

Sorry for the delayed response due to the weekend on our end.
Please try the following code to add the schema. If it does not meet your requirements after testing, please provide us with the effect you expect.
Code: Select all
 PdfDocument pdfDocument=new PdfDocument();
        pdfDocument.loadFromFile("poc-spire \\poc-spire\\app\\factur.pdf");
        FileInputStream fileStream = new FileInputStream("2. FACTUR-X_extension_schema_exemple.xmp\\2. FACTURX_extension_schema_exemple.xmp.txt");
        pdfDocument.setMetadata(PdfXmpMetadata.parse(fileStream));
        pdfDocument.saveToFile(outputFile);


The following is a screenshot of the properties of the running result document. If it does not meet your requirements after testing, please provide us with the effect you expect. We are looking forward to your feedback.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Mon Sep 01, 2025 8:20 am

Hello
sorry for this late response (was on vacation)

I will try your answer and let you know asap

Regards

ghenry_talentia
 
Posts: 8
Joined: Fri Jul 11, 2025 1:36 pm

Mon Sep 01, 2025 9:25 am

Hello,

Thank you for your response.
We look forward to receiving your valuable testing feedback.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Fri Oct 17, 2025 1:10 pm

Hello , sorry for the late response .


Using the latest spirePdf java (11.9.6) we didn't succeed to add the new metadata namespace

We do the same as you
- loading the xml schema from the file system
- using PdfXmpMetada.parse(..) and set the result to pdf using pdf.setMetadata ...

the result.pdf file doesn't contains the required metadata (see included),wee looked at it using PDFEXplorer.

ghenry_talentia
 
Posts: 8
Joined: Fri Jul 11, 2025 1:36 pm

Fri Oct 17, 2025 2:00 pm

Hello

A little update

We finally succeed to add the new metadata, we need to first convert the incoming pdf to A3/B before trying to manipulate the file ...

I think this is because the incoming pdf doesn't contains any metadata and the pdf.setMetaData seems to not add information in this case ... (to be confirmed by you ?)

Converting the file create the correct metadata entry..

Thanks

ghenry_talentia
 
Posts: 8
Joined: Fri Jul 11, 2025 1:36 pm

Mon Oct 20, 2025 8:33 am

Hello,

Sorry for the delayed response due to the weekend on our end.
Using the files you previously provided, factur.pdf and 2. FACTURX_extension_schema_exemple.xmp.txt, I have successfully added the metadata. However, I didn't reproduce issue you reported. Could you please provide us with more specific information about the issue where you encountered the direct metadata addition failure, including the file you were using, your complete test code, and your test environment details such as Windows 11 64-bit? This will help us investigate the root cause of this issue further. Thank you for your patience and understanding.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Return to Spire.PDF