We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error converting PDF to PDF/A

Hello,


I am converting a PDF to PDF/A with Aspose.pdf (16.10.0), after conversion, when the document is opened by Adobe Acrobat Reader DC (2017.009.20044) an error is shown (attached)

This is the code that does the conversion (we are using reflection because of problems with Java version, we don’t want to use imports):
pdfVersion = 3;
Object pdfDocument;
Class<?> pdfDocumentClass;
Constructor<?> pdfDocumentCons;
Method pdfDocumentMethod;
pdfDocumentClass = Class.forName(“com.aspose.pdf.Document”);
pdfDocumentCons = pdfDocumentClass.getConstructor(String.class);
pdfDocument = pdfDocumentCons.newInstance(docPath);
validationLog = File.createTempFile(“ValidationLogFile”, “.xml”);
conversionLog = File.createTempFile(“ConversionLogFile”, “.xml”);
convertedFile = File.createTempFile(“ConvertedFile”, “.pdf”);
pdfDocumentMethod = pdfDocumentClass.getDeclaredMethod(“validate”, String.class, int.class);
pdfDocumentMethod.invoke(pdfDocument, validationLog.getAbsolutePath(), pdfVersion);
pdfDocumentMethod = pdfDocumentClass.getDeclaredMethod(“convert”, String.class, int.class, int.class);
if(!(Boolean)pdfDocumentMethod.invoke(pdfDocument, conversionLog.getAbsolutePath(), pdfVersion, 0)) {
throw new RepedcBurowebException(“repedc.excepcion.bc.document.pdfa.notConverted”);
}
pdfDocumentMethod = pdfDocumentClass.getDeclaredMethod(“save”, String.class);
pdfDocumentMethod.invoke(pdfDocument, convertedFile.getAbsolutePath());
resDocumentPath = convertedFile.getAbsolutePath();

There are attached both documents, original PDF and PDF/A document converted.

Hi David,


Thanks for contacting support.

I have tested the scenario with your code snippet and Aspose.Pdf for Java 17.4.0, which is latest version, and was unable to notice the issue which you have mentioned. The file generated over our environment was fine and it did not throw any error message while opening with Adobe Reader. I have also attached resultant file(s) for your reference.

Please note that it is always recommended to use latest version of the API as it contains all fixes and enhancements. Please download latest version from the above given link and in case if you still face any issue, please feel free to let us know.


Best Regards,