Free Support Forum - aspose.com

PDF and image to PDF/A conversion

Hello,

We are tryng tto convert image to PDF_A_1A and pdfs to PDF_A_1A. We are using aspose pdf version 17.10. The program will be run on AWS cloud and we want to see if there is a way to do this conversion without using the conversion log xml

com.aspose.pdf.Document doc = new com.aspose.pdf.Document(inputFileStream);
doc.convert(“Conversion_log.xml”, com.aspose.pdf.PdfFormat.PDF_A_1A, com.aspose.pdf.ConvertErrorAction.Delete);
doc.save(outByteStream);
pdfInputStream = new ByteArrayInputStream(outByteStream.toByteArray());

@judiciary

You will be required to use conversion log XML while exporting to PDF/A. Also, you are referring to old API version and I also suggest you to please consider using the latest Aspose.PDF for .NET 21.4 on your end.

Thank You for your response.
We are using aspose with java and because of some issues we ran into when upgraded to latest versions, we are not considering upgrading to latest versions. We are providing the path where the class is available as the path for conversion log XML but that is not helping either. Any inputs on how to do this on cloud would be helpful

Path url = Paths.get(ConvertDocument.class.getResource("/").toURI());
String path = url.toString();
doc.convert(path+"/Conversion_log.xml", com.aspose.pdf.PdfFormat.PDF_A_1A, com.aspose.pdf.ConvertErrorAction.Delete);

@judiciary

Please try using the below code snippet to skip saving the conversion log file and let us know in case you face any issues:

Document doc = new Document(dataDir + "sample01.pdf");
PdfFormatConversionOptions options = new PdfFormatConversionOptions(PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
doc.convert(options);
doc.save(dataDir + "Converted1a.pdf");

We have already tried that and we got the following error and the code we have

com.aspose.pdf.internal.ms.System.IO.FileNotFoundException: File not found File: ConversionLog.xml
File name: ‘ConversionLog.xml’ —> ConversionLog.xml (Read-only file system)
com.aspose.pdf.internal.l90h.lj.(Unknown Source)
com.aspose.pdf.internal.l90h.lj.(Unknown Source)
com.aspose.pdf.internal.l90h.lj.(Unknown Source)
com.aspose.pdf.internal.ms.System.IO.l1t.(Unknown Source)
com.aspose.pdf.internal.ms.System.IO.l1t.(Unknown Source)
com.aspose.pdf.internal.ms.System.IO.l1t.(Unknown Source)
com.aspose.pdf.internal.l72v.l46v.(Unknown Source)
com.aspose.pdf.PdfFormatConversionOptions.lh(Unknown Source)
com.aspose.pdf.ADocument.lI(Unknown Source)
com.aspose.pdf.ADocument.convert(Unknown Source)
com.aspose.pdf.Document.convert(Unknown Source)

Code

PdfFormatConversionOptions options = new PdfFormatConversionOptions(PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
doc.convert(options);
doc.save(outByteStream);pdfInputStream = new ByteArrayInputStream(outByteStream.toByteArray());

Thanks
B

@judiciary

While using the same code snippet at our end with 21.3v of the API, we did not face any issue. Could you please share a sample console application which is able to replicate the same issue that you are facing. We will again test the scenario in our environment and address it accordingly.

We are using aspose 17.10 version. Could that be because of the version you are using? Will you be able to test in 17.10 version?

Thanks,
B

@judiciary,
Please note that support is provided on the basis of latest version. We log and resolve an issue if it exists in latest version of the API. Also, it is always recommended to use latest version as it contains maximum fixes and enhancements. Please use latest version and let us know if you face the issue.

Thank you for the response

We were able to test using the conversion xml on aws. However, the output pdf is not in PDF/A format

Code
doc.convert("/tmp/Conversion_log.xml", com.aspose.pdf.PdfFormat.PDF_A_1B, com.aspose.pdf.ConvertErrorAction.Delete);

When we run the program, we do not see any exception, however, the conversion xml is below. The xml has two errors. Could you please advice. The same file and code works when run locally. The issue is only when we run this code in AWS lambda

1.0

Copyright © 2001-2018 Aspose Pty Ltd. All Rights Reserved.

4/29/2021 2:24:21 AM

Object is compressed

The transparency is prohibited (‘Group’ key)

Document information entry ‘CreationDate’ not synchronized with metadata property ‘xmp:CreateDate’

Document information entry ‘ModDate’ not synchronized with metadata property ‘xmp:ModifyDate’

Required property ‘pdfaid:part’ for schema ‘pdfaid’ missing

Required property ‘pdfaid:conformance’ for schema ‘pdfaid’ missing

@judiciary

Could you please share the sample source PDF document for our reference as well. We will test the scenario in our environment and address it accordingly.

Attached the PDF

Test.pdf (30.1 KB)

@judiciary

We were able to notice the issue in our environment while testing the scenario with Aspose.PDF for Java 21.4. PDFAConformance.png (33.9 KB)

Therefore, we have logged an issue as PDFJAVA-40438 in our issue tracking system for the sake of correction. We will further look into its details and keep you posted with its rectification status. Please be patient and spare us some time.

We are sorry for the inconvenience.