Convert to PDF_A_1B works in Online converter but not using code

Hi,
Im trying to convert a simple PDF (1 page with “Test” as text)

Test.pdf (15.7 KB)

When using the following link:

The PDF is converted fine and I can validate it too using your .Validate() method:

However, once i use Aspose.PDF version 23.3 and try to convert from code, it fails.

Dim newPdf As New Aspose.Pdf.Document(“C:\Test\Test.pdf”)
newPdf.Convert(“C:\Test\PDFConvertLog.xml”, PdfFormat.PDF_A_1B, ConvertErrorAction.None)

XML Log:

1.0 Copyright (c) 2001-2023 Aspose Pty Ltd. All Rights Reserved. 27-03-2023 13:39:40 Object is compressed The xref stream is prohibited The transparency is prohibited ('Group' key) The transparency is prohibited ('Group' key)

Can you help?

@EGththo,

I was able to recreate the error. I will create a ticket for the dev team.

@EGththo
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): PDFNET-54053

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.

Any news here? Seems strange that the online version works while using the library does not?

@EGththo,

I am sorry, but I went to check on the ticket, and there is no news yet.

@EGththo

It seems, there is a bit of misunderstanding here. It is totally OK for the conversion log to contain errors and warnings as long as all of them are marked with the attribute Convertable=“True”. It means that there were some problems in the source document, but they were automatically fixed during the conversion process.

Only if the log contains errors marked as Convertable=“False”, does it mean that there were some unrecoverable problems that prohibited the document conversion.

In this case, all the errors in the log are of the Convertable=“True” kind, and the output document is a valid PDF/A-1b (you may verify it using Adobe Acrobat Preflight or VeraPDF), so the conversion was performed successfully, the same as with the web app.

Hi again,
Sorry but I have to re-visit this issue, as its still not working on my end.

Test.pdf (22.2 KB)

I am using the attached “Test.pdf” file.
I start by going into your conversion url: Convert PDF to PDF/A-1B | Online and Free

Here the Test.pdf is converted fine into PDF/A-1b format.
I download the file to my computer as “TestWebConverted.pdf”

Now…

I try using Aspose.Pdf version 24.5.1, using the following code:

		var pdfDoc = new Document(@"C:\Test\Test.pdf");
		var convertRes = pdfDoc.Convert(@"C:\Test\TestPdfLog.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.None);
		// Returns false

		// <Problem Severity="Error" Clause="Annex" ObjectID="17" Convertable="True">Object is compressed</Problem>
		// <Problem Severity="Error" Clause="Annex" Convertable="True">The xref stream is prohibited</Problem>
		// <Problem Severity="Error" Clause="6.4" Page="1" Convertable="False">The transparency is prohibited ('Group' key)</Problem>

		pdfDoc.Save(@"C:\Test\TestConverted.pdf");

		var newDoc = new Document(@"C:\Test\TestConverted.pdf");
		var validateRes = newDoc.Validate(@"C:\Test\TestPdfValidationLog.xml", PdfFormat.PDF_A_1B);
		// <Problem Severity="Error" Clause="6.4" Page="1" Convertable="False">The transparency is prohibited ('Group' key)</Problem>
		// <Header/>
		// <Annotations/>
		// <Fonts/>
		// <trailer/>
		// <Metadata>
		// <Problem Severity="Error" Clause="6.7.3" Convertable="True">Document information entry 'Creator' not synchronized with metadata property // 'xmp:CreatorTool'</Problem>
		// <Problem Severity="Error" Clause="6.7.3" Convertable="True">Document information entry 'Producer' not synchronized with metadata property // 'pdf:Producer'</Problem>
		// <Problem Severity="Error" Clause="6.7.3" Convertable="True">Document information entry 'ModDate' not synchronized with metadata property // 'xmp:ModifyDate'</Problem>
		// </Metadata>

		var newDoc2 = new Document(@"C:\Test\TestWebConverted.pdf");
		var validateRes2 = newDoc2.Validate(@"C:\Test\TestWebPdfValidationLog.xml", PdfFormat.PDF_A_1B);
		// File converted from Web returns true

So the main problem is this issue (for the attached Test.pdf file)

The transparency is prohibited (‘Group’ key)

I hope you can re-produce the same issue on your end and help me out.

@EGththo

Can you please also share the output PDF generated in your environment?

@asad.ali
Sure - I hope you mean the “TestConverted.pdf”
TestConverted.pdf (105.3 KB)

	var pdfDoc = new Document(@"C:\Test\Test.pdf");
	var convertRes = pdfDoc.Convert(@"C:\Test\TestPdfLog.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.None);
	// Returns false

	// <Problem Severity="Error" Clause="Annex" ObjectID="17" Convertable="True">Object is compressed</Problem>
	// <Problem Severity="Error" Clause="Annex" Convertable="True">The xref stream is prohibited</Problem>
	// <Problem Severity="Error" Clause="6.4" Page="1" Convertable="False">The transparency is prohibited ('Group' key)</Problem>

	**pdfDoc.Save(@"C:\Test\TestConverted.pdf");**

I also tried to run the code again where I had set a license to Aspose.Pdf to avoid the watermark - I have attached that too, but it did not help
TestConvertedWithLicense.pdf (21.0 KB)

Also, I have attached a report from the Vera tool you mentioned, if that helps:

image.png (34.5 KB)

And … as a last thing i also attached the converted file from your Web-converter-page:

TestWebConverted.pdf (21.5 KB)

@EGththo

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): PDFNET-57245

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.

@EGththo

Please use the ConvertErrorAction.Delete option with the Convert() method instead of ConvertErrorAction.None.

ConvertErrorAction.None is intented for rare cases when the document is already nearly PDF/A conformant, and the user wants it to undergo as little changes as possible during the conversion; for PDF/A-2 and -3 standards this option may allow for somewhat larger number of successful cases, but for the more strict PDF/A-1 standard it very rarely produces successful conversion.

Namely, the PDF/A-1 standard prohibits conformant documents from having any transparency, so transparency groups must be removed from the document. ConvertErrorAction.Delete option allows this modification and produces a valid PDF/A-1b document, while ConvertErrorAction.None does not.

We’re sure that our online PDF/A conversion tool does all conversions with the ConvertErrorAction.Delete option as well, otherwise it wouldn’t be able to convert most of the documents it was given including the one that you provided.