Convert PDF to PDF/A using Java and Aspose.PDF - NullPointerException

Hello!
I convert a pdf to PDF/A using this code:

Document document = new Document(new ByteArrayInputStream(this.sourceContent));
document.convert(new PdfFormatConversionOptions(PdfFormat.PDF_A_1B, ConvertErrorAction.Delete));

The conversion of this file leads to a java.lang.NullPointerException:

java.lang.NullPointerException
at com.aspose.pdf.internal.l8k.ly.lI(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lf(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lI(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lI(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lI(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.l0n(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lf(Unknown Source)
at com.aspose.pdf.internal.l8k.l0if.l0l(Unknown Source)
at com.aspose.pdf.internal.l8k.ly.lI(Unknown Source)
at com.aspose.pdf.ADocument.lI(Unknown Source)
at com.aspose.pdf.ADocument.convert(Unknown Source)
at com.aspose.pdf.Document.convert(Unknown Source)

Attached is the input pdf: example.pdf (6.1 KB)

Kind regards!

@dvtdaten

We used Aspose.PDF for Java 20.10 with following code snippet and were unable to notice any issue. Would you please check attached output PDF and below code snippet and make sure that you are using latest version of the API. Please let us know in case you still face any issue.

Document doc = new Document(dataDir + "example.pdf");
long totalStart = System.currentTimeMillis();
doc.convert(dataDir + "log.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.None);
doc.save(dataDir + "Converted.pdf");

Converted.pdf (47.0 KB)

Hello!
After a few months I took another look on this rare error. I want to inform you, that the problem occurred up to verision 21.3, but has vanished on my side since Aspose.PDF 21.4.

Kind regards!

@dvtdaten

Earlier we tested the case using 20.10 version as per our previous response and we did not notice any issue at our end. The issue may be related to your specific environment. However, it is good to know that it is resolved now by using 21.4 version of the API. Please feel free to let us know in case you need further assistance.