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.