We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF with embedded file breaks PDF/A-3b validation rule

Hello,
I need to embedd file in PDF/A-3b document. I can succesfully add the attachment file but unfortunately output PDF file does not conform to PDF/A-3b (checked with VeraPdf tool).
The document breaks Rule 6.8-4 of ISO standard:
The additional information provided for associated files as well as the usage requirements for associated files indicate the relationship between the embedded file and the PDF document or the part of the PDF document with which it is associated.
In order to resolve the issue I would like to reference embedded file in Catalog dictionary, however I couldn’t find any information on this in your documentation. Could you please advice on how to do it?

@ewa.makowska.onwelo

We need to investigate the feasibility of this functionality. Can you please share a sample PDF with us as well along with the sample code snippet that you are using to attach the file? We will log an investigation ticket and share the ID with you.

Code snippet I use:

var demoDocument = new Document("demo.pdf");
string aKey = "demo.Attachment";

using (FileStream fs = File.Open("demo_attachment.xml", FileMode.Open)) {
    FileSpecification attachmentSpecification = new FileSpecification(fs, "PMP.Data.xml");
    attachmentSpecification.MIMEType = MediaTypeNames.Application.Xml;

    // Strange behaviour of setting AFRelationship
    // If you set it in attachmentSpecification before adding to EmbeddedFiles Collection (as MIMEType is)
    // as below:
    attachmentSpecification.AFRelationship = AFRelationship.Data;
    // it turnes out that after attaching to EmbeddedFiles the AFRelationship is set to None

    demoDocument.EmbeddedFiles.Add(aKey, attachmentSpecification);
    
    // When you set AFRelationship here it would save correctly:
    demoDocument.EmbeddedFiles[aKey].AFRelationship = AFRelationship.Data;
}
demoDocument.Save($"demo_with_attachment.pdf");

Files (input file, output file genereted by aspose, vera pdf reports for both):

aspose_files.zip (284.4 KB)

@ewa.makowska.onwelo

We have logged an investigation ticket as PDFNET-51459 in our issue tracking system to further analyze your requirements. We will investigate the feasibility of this feature and let you know as soon as it is implemented. Please be patient and spare us some time.

We are sorry for the inconvenience.