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.

Wed Jul 10, 2024 4:41 pm

I'm using the last spire.pdf.free-9.12.3.jar
Is this javascript code correct?

Code: Select all
var xmlAttachmentBytes = FileUtil.readBytes(xmlFile.getAbsolutePath());
logger.info("Dimensione di xmlAttachmentBytes: " + xmlAttachmentBytes.length);
var attachment = new com.spire.pdf.attachments.PdfAttachment("cda.xml");
attachment.setData(xmlAttachmentBytes);
attachment.setDescription("cda.xml");
attachment.setMimeType("application/xml");
doc.getAttachments().add(attachment);


When I save the PDFA3:

Code: Select all
var byteArrayOutputStream = new ByteArrayOutputStream();
doc.saveToStream(byteArrayOutputStream, com.spire.pdf.FileFormat.PDF);


The resulting PDFA3 contain the cda.xml attachment with 2 times the same XML text in it.
I've verified that the cda.xml file to be attached is correct and contain only one XML text.

warpengine
 
Posts: 1
Joined: Wed Feb 14, 2024 9:40 am

Thu Jul 11, 2024 5:47 am

Hi,

Thank you for your inquiry.
Since we rarely update and maintain the free version, we recommend using the latest commercial version of Spire.Pdf for Java for testing as it includes more fixes. If you still encounter issues after testing with the new version, please provide us with your test files (XML file and PDF file) and your testing environment (e.g., Windows 10) for further investigation and testing. Thank you for your cooperation.

Spire.pdf for Java 10.6.2:https://www.e-iceblue.com/Download/pdf-for-java.html

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 334
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.PDF

cron