I want to do the following in web application developed using .NET(JQUERY, ANGULAR):
1. Check PDF is password protected or not
2. Check PDF is corrupted or not
Please help with sample codes and examples
Copy link to clipboard
You cannot know either of these things without a tool that parses a PDF file, for example, a viewer like Acrobat. However, you could write a relatively simple program to examine the PDF trailer to find out if there is security applied to the PDF.
And finally, there is absolutely no way to know if the PDF is corrupted without a tool that fully parses the PDF.
Thanks, I would go with C#. Please can you help what do I need to check PDF security in C#. what is recommended PDF trailor and API?
Appreciate if you can share some sample coding.
I think C# will work fine, but I have never written any code for parsing a PDF trailer, so that's something you'll need to do yourself.
To do this you need to read the PDF Specification as it relates to the trailer. In this case you shouldn't need an API. You'll need to write code to parse the trailer.
On the other hand, there are some free PDF libraries, such as Quick PDF from FoxIt. You may be able to get the info you want with one of these, which would be much simpler that parsing it yourself. But again, I haven't done this myself.
Are there any methods or properties in AxAcroPDFlib library to check PDF's security like password protected or not?
You can read about it here: Acrobat DC SDK Documentation