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 14, 2021 7:29 am

Hi,

when adding an embedded file (via PdfAttachment) and setting the mime type to e.g. text/xml, the dictionary in the resulting file will have set the /Subtype /text#232fxml instead of the expected /Subtype /text#2fxml. This violates the PDF/A-3A validation suite (ISO 19005-3:2021, clause 6.8, test 1) and makes the resulting file unusable for us.

The bug appears to result in the string text/xml being escaped twice instead of once: text/xml -> text#2fxml -> text#232fxml, thus the # also beeing replaced.

I'd be grateful for a fix, I currently use version 7.6.15.0 of Spire.PDF.

Sebastian Boettcher

sboettcher
 
Posts: 6
Joined: Tue Dec 22, 2020 7:20 am

Wed Jul 14, 2021 10:40 am

Hello,

Thanks for your inquiry.

I tested the following code with the latest Spire.PDF v7.6.15, but did not notice the issue you mentioned. I checked the generated document through Adobe's Preflight function, the mime type of the attachment is "text#2Fxml", as shown in the attached screenshot.

Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("test.pdf");
//PdfPageBase page = doc.Pages[0];
PdfAttachment attachment = new PdfAttachment("Orders.xml");
attachment.Data = File.ReadAllBytes("Orders.xml");
attachment.Description = "xml";
attachment.MimeType = "text/xml";
doc.Attachments.Add(attachment);
doc.SaveToFile("Attachment.pdf"); 
doc.Close();
PdfStandardsConverter converter = new PdfStandardsConverter("Attachment.pdf");
converter.ToPdfA3A("PDFA3A.pdf");


To help us investigate further, please provide your input files as well as your output file. You could send them to us ([email protected]) via email. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Jul 14, 2021 12:07 pm

Hello Rachel,

thank you for your reply. I've tried your code and attached the input files test1.pdf and test1.xml and the resulting file out.pdf.

The problem still persists:

  • - when viewing out.pdf in a simple text editor, have a look at line 110: there you can see the double-encoded string text#232fxml instead of text#2fxml

  • - in your screenshot, the problem is also visible: the MIME type is displayed as text#2Fxml (once decoded) but should read text/xml.

Cheers,
Sebastian

Files.zip

sboettcher
 
Posts: 6
Joined: Tue Dec 22, 2020 7:20 am

Thu Jul 15, 2021 2:32 am

Hello,

Sorry I misunderstood and thanks for your further clarification.

When using a simple text editor to view the generated PDF, I did found that it displayed /Subtype /text#232fxml instead of the expected /Subtype /text#2fxml. I have logged this issue in our bug tracking system with the ticket SPIREPDF-4465. If there is any update, we will let you know.

Sorry for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Aug 04, 2021 11:20 am

Hello,

Hope you are doing well.

Glad to inform you that we just released Spire.PDF Pack(Hot Fix) Version:7.8.2 that fixes the issue SPIREPDF-4465. Welcome to download it from the following links.

Our website: https://www.e-iceblue.com/Download/down ... t-now.html
NuGet: https://www.nuget.org/packages/Spire.PDF/7.8.2

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Aug 05, 2021 6:26 am

Hello Rachel,

thank you very much. I could successfully verify that the bug got fixed.

Sincerely,
Sebastian

sboettcher
 
Posts: 6
Joined: Tue Dec 22, 2020 7:20 am

Thu Aug 05, 2021 7:02 am

Hi Sebastian,

Thanks for your feedback.

If you encounter any problems related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.PDF