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