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

Free Support Forum - aspose.com

Aspose pdf does not throw exception for pdf with restrictions for pdfa rendition

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)

@sumeetm

Regretfully, no such exception handling has been implemented to the API yet. However, we have logged an enhancement ticket as PDFJAVA-39603 in our issue management system for your requirements. We will investigate its feasibility and keep you posted with the status of tikcet resolution. Please have patience and give us some time.

We apologize for the inconvenience.