Welcome Guest Search | Active Topics | Sign In | Register

Password protected Options
Ivan
Posted: Monday, January 7, 2019 12:01:55 PM
Rank: Newbie
Groups: Member

Joined: 1/7/2019
Posts: 2
Hi,
is there any way in EO to check if a pdf is password protected or read only?

I want to edit a pdf but first I want to check check if it is password protected.

Thanks!
eo_support
Posted: Monday, January 7, 2019 2:39:33 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

You can just try to open the PDF file with new PdfDocument(file_name) and if it throws an exception with "invalid password" message, then the file is password protected.

Note that for PDF file, it's possible that the file is not password protected but is marked as "secure". In this case you can load the file without any password, but PdfDocument.Security.OwnerPasswordProvided will be true. However the PDF specification states that you should not honor the permission settings on the file (exposed to you through PdfDocument.Security.Permissions), however there is nothing technical that prevents you from modifying the file in this case.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.