Free Support Forum - aspose.com

How to check BeEncrypted in the PDF kit dll (5.0) it thowing exception

hello,

we are using the Aspose.Pdf.Kit.dll with version 5.0.0.1.

the problem we are facing, to check the pdf file is encrypted or not we are using the BeEncrypted flag and it was working in the dll 3.1.0.0.This is not working in the new dll

The Code :

Dim fo As Aspose.Pdf.Kit.PdfFileInfo = New Aspose.Pdf.Kit.PdfFileInfo(filePath)

If fo.BePdfFile AndAlso fo.BeEncrypted Then

Return True

End If

we are getting the expection on this line,

Dim fo As Aspose.Pdf.Kit.PdfFileInfo = New Aspose.Pdf.Kit.PdfFileInfo(filePath)

System.IO.IOException: Bad password!: v5.0.0.1<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

at Aspose.Pdf.Kit.PdfFileInfo.xe9a17d28df670f4d()

at Aspose.Pdf.Kit.PdfFileInfo..ctor(String inputFile)

at Core.PdfAPI.PDFConverter.IsSecuredPdf(String filePath) in

so can you please tell that how could we check the BeEncrypted in the New Version(5.0) of PDF file DLL?

Please reply as soon as possible.

Regards,

Khushbu Desai

Hi Khushbu,

Please share the input PDF file with us, so we could test the issue at our end. Moreover, it seems like the file is password protected; could you please share the password for this particular PDF file as well?

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Hi,

as per the security policy in our company, we can't share the PDF document. but here i have attach the properties screen of the PDF.

please find the attach file.

Hi Khushbu,

We’ll try to reproduce this issue at our end and update you with the results accordingly. Please spare us some time, so we could investigate it in detail.

We’re sorry for the inconvenience and appreciate your patience.
Regards,

Hi Khushbu,

I have tried to produce the encrypted PDF file at my end and open it using PdfFileInfo class, however I’m still unable to reproduce this issue. Please share the problematic PDF file with us; the file will be used internally by the Aspose staff for testing purposes. However, if you don’t want to share the original PDF file then please try to produce a similar file at your end with dummy data, which can reproduce the same issue.

I would like to add that it is very important for our team to reproduce the issue at our end in order to understand the issue and then resolve it.

We’re sorry for the inconvenience and appreciate your cooperation.
Regards,

is this issue solved? If yes, how it is solved?

I have a password protected pdf and I am using below function to check whether pdf is encrypted

public bool IsEncryptedFile(String inputFileName)

{

var pdf = new PdfFileInfo(inputFileName);

return pdf.BeEncrypted;

}

but while creating PDFFileInfo object it fails with exception Bad Password. If I double click file and open file with password, it opens.

I am attaching password protected pdf.

Thanks,

SubbaM

Hi SubbaM,

I have logged this issue as PDFKITNET-28490 in our issue tracking system. Our team will further investigate it and you’ll be updated as soon as it is resolved.

We’re sorry for the inconvenience.
Regards,

Looks like it is common problem and you might have solution for this. Are you saying right now you don't have a way to know by giving password protected pdf and identifying the pdf whether it is password protected or not?

Iam waiting to complete the enhancement assigned to me, please let me know ASAP what you find out.

Hi SubbaM,

I’m afraid, in particular scenarios this might not work. That’s why I have logged the issue for further investigation. I’m sorry that we do not have any other way at the moment to find out whether a file is protected or not. We’ll try to resolve the issue as soon as possible and update you accordingly.

We’re sorry for the inconvenience.
Regards,