Convert docx to PDF/UA

I’m trying to convert a very simple docx to PDF/UA, but when using an external PDF/A verifier it reports issues. I see there are several incidents reported on the Aspose forum for this topic, but i find it a little bit difficult to navigate and find a solution.

At the moment we’re running Aspose.Words 22.8 and use the following code to generate the PDF/UA file:

Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.Compliance = Aspose.Words.Saving.PdfCompliance.PdfUa1;
options.ExportDocumentStructure = true;
options.DisplayDocTitle = true;
 
// Update all merge fields to display their correct results.
List<Aspose.Words.Fields.Field> mergefields = wordDoc.Range.Fields.Where(f => f.Type == Aspose.Words.Fields.FieldType.FieldMergeField).ToList();
foreach (Aspose.Words.Fields.Field f in mergefields)
	f.Unlink();

wordDoc.UpdateFields();
wordDoc.Save(dstFilename, options);

Please have a look at the attached source and Aspose generated PDF/UA file here:
This is a very simple docx.docx (12.0 KB)

This is a very simple docx.pdf (15.2 KB)

The source docx report no accessability issues in Word 2021, but still,
the online PDF/A verifier reports problems.
https://bfo.com/blog/2017/11/08/verify_pdfa_online/

Can you please have look into this problem as PDF/UA is very soon becoming a requirement for our customers.

@andersalvsaker As I can see your document has been postprocessed:

Most likely postprocessing damaged the document structure.
Also, your source document does not have a title, so it is not exported to PDF. PDF document produced by the following code passes validation by both PAC3 and bfo.com/:

Document doc = new Document(@"C:\Temp\in.docx");
doc.BuiltInDocumentProperties.Title = "This is cool title";
PdfSaveOptions opt = new PdfSaveOptions();
opt.Compliance = PdfCompliance.PdfUa1;
doc.Save(@"C:\Temp\out.pdf", opt);

out.pdf (12.8 KB)

1 Like

Hi Alexey,

I’m sorry. I was way to quick here to report this incident. When i remove the postprocessing and add a title to any Word document, Aspose.Words produces a perfect PDF/UA :slight_smile:

Thank you for your quick clearification of this !

1 Like