PDDocument retVal = null;
FileLocator locator = new FileLocator(inputFile);
if (password != null) {
Map options = new HashMap();
final char[] pwd = password.toCharArray();
PasswordProvider.setPasswordProvider(options, new IPasswordProvider() {
public char[] getPassword() {
return pwd;
}
});
retVal = PDDocument.createFromLocator(locator, options);