How do I open a password protected PDF file?

158 views
Skip to first unread message

Support

unread,
Aug 21, 2008, 1:29:10 PM8/21/08
to PDFTron PDFNet SDK
Q: I wanted to know if there is any means to open a password protected
PDF file.

The class PDFDoc only takes one argument (the filepath). So, is there
any other class that can be used to open a password protected .pdf
file?

------
A: To open secured PDF documents you can call InitStdSecurityHandler()
after creating the document:

For example:

PDFDoc doc = new PDFDoc("secured.pdf");
if (!doc.InitStdSecurityHandler("test")) {
// Incorrect password ... try calling InitStdSecurityHandler() with
a different password?
}

For a full sample code please take a look at EncTest sample project
(http://www.pdftron.com/net/samplecode.html#EncTest).

There some other ways to process secured PDFs using PDFNet but the
above approach is the simplest.
Reply all
Reply to author
Forward
0 new messages