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 Feb 01, 2024 10:36 am

Hi!
I'm using a "Spire.PDF for JAVA" v. 9.2.1 with commercial license (bought on last March 2023)
I'm trying a simple app with the follow java code (my IDE is using JDK jdk 1.8.0_211) for create a PDF/A with an xml file attached.
When I try to set the mime type "application/pdf" in the resulting file will have set the /Subtype "/application#2Fxml" instead of the expected /Subtype "/application/xml".
This is my code:

PdfDocument pdfDoc = new PdfDocument();
pdfDoc.loadFromFile(inputPdfPath);

//Read file to attach:
byte[] attBytes = Files.readAllBytes(Paths.get(attachmentPath));

//Create attachment:
PdfAttachment attachment = new PdfAttachment("cda.xml", attBytes);
//Set mime-type:
attachment.setMimeType("application/xml");

//Add Attachment to pdf
pdfDoc.getAttachments().add(attachment, pdfDoc, PdfAttachmentRelationship.Data);


The issue is similar to what is reported in this other topic:
mime-type-of-attachment-encoding-t10374.html

With "Spire.PDF for .Net" v. 9.2.2 the mime-types appear correctly.

Have you any suggestion about how to solve this issue?

Best regards,
Filippo Gatto

filippo.gatto
 
Posts: 11
Joined: Fri Feb 24, 2023 3:08 pm

Fri Feb 02, 2024 3:11 am

Hello,

Thank you for your inquiry.
I did a preliminary test based on your description. Some of the PDFA result files reproduce the issue you mentioned. But I still want to confirm with you that your result files are PDF/A1A, PDF/A2A or other PDFA type documents. Please let me know clearly. Thanks in advance.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Fri Feb 02, 2024 8:26 am

Hi Annika, I'm using "PDF/A-3A" pdfa type (converter.toPdfA3A). I attach an example of pdf/a-3a produced.

Best regards,
Filippo Gatto

filippo.gatto
 
Posts: 11
Joined: Fri Feb 24, 2023 3:08 pm

Fri Feb 02, 2024 8:48 am

Hello,

Thank you for your feedback.
I reproduced the issue of incorrect MIME-TYPE after parsing PDF documents of type PDF/A3A embedded in xml attachments. I have logged the issue into our bug tracking system with the ticket number SPIREPDF-6542. Our development team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Mon Feb 26, 2024 9:45 am

Hello,

Thanks for your patience!
Glad to inform you that we just released Spire.PDF for Java Version:10.2.6 which fixes the issue of SPIREPDF-6542.
Welcome to test it.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Mon Feb 26, 2024 3:37 pm

Hi Annika, I've tested the last released version and the issue was fixed!
Thank you very much!!

Filippo

filippo.gatto
 
Posts: 11
Joined: Fri Feb 24, 2023 3:08 pm

Tue Feb 27, 2024 2:51 am

Hello,

You're welcome.
If you encounter other issues related to our products in the future, please feel free to contact us.
Have a nice day.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.PDF