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

Free Support Forum - aspose.com

Password protected file its taking as corrupted file

PdfFileInfo info = info.isPdfFile();
if(info.isPdfFile()) {
pdfDocument = new com.aspose.pdf.Document(pdfPath);
objMap.put(BoConstants.PDF_DOC, pdfDocument);
checkAllPdfValidation(validateParams, pdfRules, objMap);
pdfDocument.close();
} else{
System.out.println(“corrupted doc”);
}

I am using aspose 19.11 pdf version. help me out in figuring out this.
lspublish-openpwd-yes-pswd-protected (1).pdf (11.0 KB)
Password:welcome

@rampujar

Would you kindly share the password of PDF file that you have shared. We will test the scenario in our environment and address it accordingly.

i have attached my document and password in my first query

@rampujar

In case the PDF is password protected, you need to load it by providing password along with file path. Please check following code snippet that we have used and output was fine:

com.aspose.pdf.facades.PdfFileInfo info = new com.aspose.pdf.facades.PdfFileInfo();
info.bindPdf(dataDir + "lspublish-openpwd-yes-pswd-protected (1).pdf", "welcome");
if(info.isPdfFile()) {
 System.out.println("fine doc");
} else{
 System.out.println("corrupted doc");
}

Hi asad.ali,
Thanks for the response.
but my scenario is. I will not be knowing the password of pdf file. I need to check if its password protected file or not. for that I am using isEncrypted method provided by you people.
but I am getting as corrupted even thought its a password protected file.

do the need ful. the file link has been given in the above reply.

Thanks.

@rampujar

We have logged an investigation ticket as PDFJAVA-39315 in our issue tracking system to determine whether it is possible to process password-protected PDF without knowing the password through the API. We will further look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi asad.ali,
Thanks for your response,
My requirement is, I need to check if pdf file is password protected or no. for that I am using
if(pdfFile.isPdfFile)
{
Sysout(“Pdf”);
} else{
Sysout(“corrupted Pdf”);
}
the above code I have used to check if its a pdf file or no its working for all the password protectedd pdf files.
but for the above file which is password protected attached in my previous replies. Its taking as corrupted instead it must be a password protected file.

Thanks

@rampujar

We have updated the logged ticket as per your requirements and will surely inform you as soon as we have some additional updates about its resolution.