Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, January 3, 2018 10:18:17 AM(UTC)


Groups: Registered
Posts: 3

I am looking at working with password protected PDFs and I am wondering about the following workflow.

Can you determine the if a password protected PDF is print-restricted prior to having the password or do you need to enter have the password before you can access the restricted actions?

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, January 3, 2018 10:46:29 AM(UTC)


Groups: Registered
Posts: 3


So what would be the workflow?

#3 Posted : Wednesday, January 3, 2018 11:34:35 AM(UTC)
Anthony Northrup

Groups: Registered, Tech Support, Administrators
Posts: 199

Was thanked: 28 time(s) in 28 post(s)

Hello David,

I was incorrect in my last reply, you can read this information by using the PDFDocument class. Below is a snippet you can use to print out the security options for a PDF. And to answer your original question, you will need to supply a password before anything can be read about the document.


string fileName = @"C:\temp\Sample.pdf";

bool encrypted = PDFFile.IsEncrypted(fileName);
string password = null;
if (encrypted)
	Console.Write("File is encrypted, please enter password: ");
	password = Console.ReadLine();

PDFDocument document = new PDFDocument(fileName, password);

Console.WriteLine(String.Format("IsEncrypted: {0}", document.IsEncrypted));

if (document.SecurityOptions != null)
	PDFSecurityOptions o = document.SecurityOptions;
	Console.WriteLine(String.Format("\tAnnotationsEnabled: {0}", o.AnnotationsEnabled));
	Console.WriteLine(String.Format("\tAssemblyEnabled: {0}", o.AssemblyEnabled));
	Console.WriteLine(String.Format("\tCopyEnabled: {0}", o.CopyEnabled));
	Console.WriteLine(String.Format("\tCopyForAccessibilityEnabled: {0}", o.CopyForAccessibilityEnabled));
	Console.WriteLine(String.Format("\tEditEnabled: {0}", o.EditEnabled));
	Console.WriteLine(String.Format("\tEncryptionMode: {0}", o.EncryptionMode));
	Console.WriteLine(String.Format("\tFormFieldFillingEnabled: {0}", o.FormFieldFillingEnabled));
	Console.WriteLine(String.Format("\tHighQualityPrintEnabled: {0}", o.HighQualityPrintEnabled));
	Console.WriteLine(String.Format("\tOwnerPassword: '{0}'", o.OwnerPassword));
	Console.WriteLine(String.Format("\tPrintEnabled: {0}", o.PrintEnabled));
	Console.WriteLine(String.Format("\tUserPassword: '{0}'", o.UserPassword));
	Console.WriteLine("SecurityOptions: null");
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.

#4 Posted : Wednesday, January 3, 2018 11:49:13 AM(UTC)


Groups: Registered
Posts: 3

Thank you!
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.046 seconds.