implement validation of owner password and throw more descriptive exception for encrypted documents

This commit is contained in:
Eliot Jones
2019-05-09 19:02:39 +01:00
parent 53811a7d97
commit 23c033c788
6 changed files with 184 additions and 53 deletions

View File

@@ -6,6 +6,7 @@
using Content;
using CrossReference;
using Encryption;
using Exceptions;
using IO;
using Logging;
using Parser;
@@ -137,7 +138,19 @@
log.Debug($"Accessing page {pageNumber}.");
return pages.GetPage(pageNumber);
try
{
return pages.GetPage(pageNumber);
}
catch (Exception ex)
{
if (IsEncrypted)
{
throw new PdfDocumentEncryptedException("Document was encrypted which may have caused error when retrieving page.", encryptionDictionary, ex);
}
throw;
}
}
/// <summary>