pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilija Pavlic <ilija.pav...@gmail.com>
Subject Re: How to check if a password is the document open password
Date Sat, 11 Feb 2012 00:27:09 GMT
if (document.isEncrypted()) {
				try {
					document.decrypt("your password");
				} catch (InvalidPasswordException e) {
					System.err.println("Error: Document is encrypted with a different password."); // so,
now you know that your password is incorrect for your file


On 11. 2. 2012., at 01:22, yankefrank@optonline.net wrote:

> How can a java program check to see if a given password is the correct password to open
a pdf document?  We have a table that shows what password should have been set as the correct
password for a given file.  
> I want to traverse this list of files and figure out which files had the password set
correctly and which did not.  I can traverse the table, but what piece of code or what method
or methods in PDFBOX will let me check if a particular password is the right document open
> Thanks to anyone who can shed any light on this.
> - Frank

View raw message