public void Parse(string password) { long xrefPos = findXref(); parseXref(xrefPos); PDFDictionary encrypt = _trailer["Encrypt"] as PDFDictionary; if (encrypt != null) { Encryptor encryptor = new Encryptor(encrypt, _trailer["ID"] as PDFArray); if (!encryptor.AuthenticatePassword(password)) { throw new InvalidPasswordException(new PasswordManager(encryptor)); } encryptor.RecalculateEncryptionKey(); _xref.Encryptor = encryptor; _lexer.SetEncryptor(encryptor); } _xref.Entries.TrimExcess(); _xref.SetTrailer(_trailer); }