Read Password Protected PDF File in C#

Hello,

I would like to know if it is possible to read password protected PDF file in C# and exhibit a decrypted PDF File without having to save it to disk. If possible, please send some sample code.

Thanks,

Alexandre

@a.degas

Can you please explain a bit more about your requirements? Do you want to read encrypted or password protected PDF in C# and display it in your application? OR you want to process it without saving it to disk?

Hello Asad,

I want to read an encrypted PDF file from disk in C# and display it on a webpage using ASP.NET Core, is that possible? Also, I am not being able to run you sample application Aspose.Pdf.Live.Demos.UI, I keep getting the following errors:

Can you understand it although the messages are in Portuguese?

Regards,

Alexandre

@a.degas

Sure, you can read an encrypted PDF using the API in C# and use it for further processing or displaying it as image in your application. You need to specify the PDF password in Document constructor to read an encrypted PDF document like below:

Document doc = new Document("Encrypted.pdf", "Password");

Furthermore, please note that the API does not offer and viewer or control to view to PDF files in the application. You can convert the PDF document into images and show those images in HTML Canvas. Regarding the sample application of Aspose.Pdf.Live.Demos.UI, please create a post in respective support forum where you will be assisted accordingly.