Hi,
I am using aspose pdf for generating a pdf to pdfa rendition.
Sample code:-
try {
com.aspose.pdf.Document document = new com.aspose.pdf.Document(“C:\Users\Administrator\Desktop\D2\Without_permission.pdf”);
PdfFormatConversionOptions opts = new PdfFormatConversionOptions(“C:\Users\Administrator\Desktop\D2\logFile.txt”, PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
opts.setOptimizeFileSize(true);
document.convert(opts);
document.optimize();
document.save(“C:\Users\Administrator\Desktop\D2\output.pdf”);
document.dispose();
} catch (Exception e) {
System.out.println("Exception while converting PDF to PDFA compliance : "+e.getMessage());
}
Issue:-
If the input pdf does not have modification permissions, Aspose pdf does not throw any exception and for the obvious reason does not give a valid PDFA rendition as well.
Yes, it does create logs which are as follows :
1.0Copyright © 2001-2019 Aspose Pty Ltd. All Rights Reserved.7/22/2020 9:59:31 AMConversion is not allowed by permission restrictions
I want to know if there is any way we can generate an exception, so that we can warn user about the same in our product.
attaching the log file, input and output files.
shared.zip (2.8 MB)