PdfFormat A4 not fully supported?

Hi,

I use the convert API in Apose.PDF for Java to convert a PDF into various conformance levels.

When I use any level except A4 then everything works.

e.g. when I execute this method:

pdfDocument.convert(os, PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);

Then after execution pdfDocument.getPdfFormat() return PDF_A_1A

But then I use PDF_A_4 as below:

pdfDocument.convert(os, PdfFormat.PDF_A_4, ConvertErrorAction.Delete);

Then pdfDocument.getPdfFormat() returns v_2_0 ant not PDF_A_4

Why is PDF A/4 behavior different then all previous standards?

@Mariusz_Pala

The behavior you’re experiencing with the conversion to PDF/A-4 is likely due to the specific requirements and limitations associated with that conformance level. PDF/A-4 is based on PDF 2.0, which introduces new features and changes that may not be fully supported in the version of the Aspose.PDF library you are using.

When you convert to PDF/A-4 and it returns v_2_0, it indicates that the document is being treated as a PDF 2.0 document rather than strictly adhering to the PDF/A-4 standard. This could be due to the content of the original PDF or the features used in the conversion process that are not compatible with PDF/A-4.

To troubleshoot this issue, consider the following steps:

  1. Check for Compatibility: Ensure that the original PDF does not contain any elements that are incompatible with PDF/A-4.
  2. Update Aspose.PDF: Make sure you are using the latest version of the Aspose.PDF library, as updates may include improved support for PDF/A-4.
  3. Review Documentation: Consult the Aspose.PDF documentation for any specific notes regarding PDF/A-4 conversion and supported features.

If the issue persists, consider reaching out to the Aspose support forum for more detailed assistance.

I am using the latest Aspose.PDF version and the issue is reproducible on any file, including those created with Aspose, e.g. Word using code below - saved as PDF and then converted using Aspose.PDF.

So this is not related to specific file or non-latest Aspose library.

	com.aspose.words.Document doc = new com.aspose.words.Document();

		Paragraph headingParagraph = new Paragraph(doc);
		Paragraph bodyParagraph = new Paragraph(doc);

		headingParagraph.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_1);

		Run run = new Run(doc, "Heading 1");
		headingParagraph.appendChild(run);
		doc.getFirstSection().getBody().appendChild(headingParagraph);

		bodyParagraph.appendChild(new Run(doc, SAMPLE_TEXT));
		doc.getFirstSection().getBody().appendChild(bodyParagraph);

Now I see in the conversion logs the following output - but how to make the PDF generated from Word not failing with such error - what that error mean?

<Compliance Name="Log" Operation="Validation" Target="PDF/A-3B"><Version>1.0</Version><Copyright>Copyright (c) 2001-2025 Aspose Pty Ltd. All Rights Reserved.</Copyright><Date>10/22/2025 10:13:58 AM</Date><File Version="1.7" Name="renderer_pdf14613341914205401133.pdf" Pages="1"><Security /><Catalog /><Header /><Annotations /><Fonts /><trailer><Problem Severity="Error" Clause="6.1.3" Convertable="True">The trailErrorIncorectSymbolicFontEncodinger dictionary does not contain 'ID'</Problem></trailer><Metadata><Problem Severity="Error" Clause="6.6.2.1" Convertable="True">Metadata key does not exists</Problem></Metadata><objects /><xObjects /><actions /><xmpmeta /><EmbeddedFiles /></File></Compliance>

@Mariusz_Pala

The log you sharing contains error(s) that API faced during the PDF to PDF/A conversion. These are not the errors that are present in the output generated by the API. Nevertheless, we tested a simple case using below code snippet and could not replicate the issue. Please note that you need to re-initialize the Document object in order to load newly converted PDF/A file so that you can get correct PDF format:

Document doc = new Document(dataDir + "test.pdf");
doc.convert(dataDir + "log.xml", PdfFormat.PDF_A_2A, ConvertErrorAction.Delete);
doc.save(dataDir + "output.pdf");

doc = new Document(dataDir + "output.pdf");
System.out.println(doc.getPdfFormat());

Output:

PDF_A_2A

Hi,

As I mentioned before, the issue occurs with A4 format only. We do re-init the document after conversion, but for all docs during conversion to A4 we get the same error which we don’t get with other conformance levels.

What is the reason? How to find the cause to fix it?

  • The trailErrorIncorectSymbolicFontEncodinger dictionary does not contain ‘ID’
  • Metadata key does not exists

We found the issue. The PDF 2.0 in Aspose API - for unknown reason require specific API to set properties. Using this “if” solves the issue.

Is there an alternative for docInfo.clearCustomData(); in 2.0 version?
Since pdfDocument.getMetadata() makes the PDF corrupted we cannot use it and there is no alternative as I can see.

boolean isPDF2 = pdfDocument.getVersion().equals("2.0");
			if (isPDF2) {
				//PDF 2.0 requires metadata to be set not Document Info
				logger.debug("Setting PDF metadata");
				pdfDocument.getMetadata().set_Item("xmp:Producer", XmpValue.to_XmpValue(App.APP_NAME));
				pdfDocument.getMetadata().set_Item("xmp:Creator", XmpValue.to_XmpValue(App.APP_NAME));
				
				if (request.getTitle() != null)
					pdfDocument.getMetadata().set_Item("xmp:Title", XmpValue.to_XmpValue(request.getTitle()));
				else
					pdfDocument.getMetadata().removeItemByKey("xmp:Title");
				
				if (request.getAuthor() != null)
					pdfDocument.getMetadata().set_Item("xmp:Author", XmpValue.to_XmpValue(request.getAuthor()));
				else
					pdfDocument.getMetadata().removeItemByKey("xmp:Author");
				
				if (request.getSubject() != null)
					pdfDocument.getMetadata().set_Item("xmp:Subject", XmpValue.to_XmpValue(request.getSubject()));
				else
					pdfDocument.getMetadata().removeItemByKey("xmp:Subject");
				
				if (request.getKeywords() != null)
					pdfDocument.getMetadata().set_Item("xmp:Keywords", XmpValue.to_XmpValue(request.getKeywords()));
				else
					pdfDocument.getMetadata().removeItemByKey("xmp:Keywords");

			} else {
				logger.debug("Setting PDF properties");
				DocumentInfo docInfo = pdfDocument.getInfo();
				docInfo.clearCustomData();
				docInfo.setProducer(AppAPP_NAME);
				docInfo.setCreator(App.APP_NAME);
				if (request.getTitle() != null)
					docInfo.setTitle(request.getTitle());
				if (request.getAuthor() != null)
					docInfo.setAuthor(request.getAuthor());
				if (request.getSubject() != null)
					docInfo.setSubject(request.getSubject());
				if (request.getKeywords() != null)
					docInfo.setKeywords(request.getKeywords());
			}

@Mariusz_Pala

We need to investigate this scenario in details. If possible, can you please share a sample PDF 2.0 for our reference? We will log an investigation ticket and share the ID with you.

The case is simple, our customer wants to convert some files into PDF in either 2.0 or 1.7 version.
But they want to remove all custom properties/metadata and set defined by them.
With Aspose.PDF this property management is not straighforward and requires the “if” I pasted above.
With pre-2.0 version we could use docInfo.clearCustomData() method, but with 2.0 version there is no method do to something like this. Doing the below causes failure at the convert to 2.0 process which we run just after - with the error from previous message.

pdfDocument.getMetadata().clear();
pdfDocument.save()

@Mariusz_Pala

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFJAVA-45553

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.