#10 make all token classes public and expose via a public structure member on pdf document

This commit is contained in:
Eliot Jones
2018-11-24 19:02:06 +00:00
parent 8c0e8d5f26
commit 2fa781b8e9
49 changed files with 824 additions and 187 deletions

View File

@@ -3,8 +3,7 @@
using System;
using System.IO;
using Content;
using Cos;
using Exceptions;
using CrossReference;
using FileStructure;
using Filters;
using Fonts;
@@ -123,7 +122,7 @@
var rootDictionary = ParseTrailer(crossReferenceTable, isLenientParsing, pdfScanner);
var information = informationFactory.Create(pdfScanner, crossReferenceTable.Dictionary);
var information = informationFactory.Create(pdfScanner, crossReferenceTable.Trailer);
var catalog = catalogFactory.Create(pdfScanner, rootDictionary);
@@ -135,17 +134,12 @@
private static DictionaryToken ParseTrailer(CrossReferenceTable crossReferenceTable, bool isLenientParsing, IPdfTokenScanner pdfTokenScanner)
{
if (crossReferenceTable.Dictionary.ContainsKey(NameToken.Encrypt))
if (crossReferenceTable.Trailer.EncryptionToken != null)
{
throw new NotSupportedException("Cannot currently parse a document using encryption: " + crossReferenceTable.Dictionary);
throw new NotSupportedException("Cannot currently parse a document using encryption: " + crossReferenceTable.Trailer.EncryptionToken);
}
if (!crossReferenceTable.Dictionary.TryGet(NameToken.Root, out var rootToken))
{
throw new PdfDocumentFormatException($"Missing root object specification in trailer: {crossReferenceTable.Dictionary}.");
}
var rootDictionary = DirectObjectFinder.Get<DictionaryToken>(rootToken, pdfTokenScanner);
var rootDictionary = DirectObjectFinder.Get<DictionaryToken>(crossReferenceTable.Trailer.Root, pdfTokenScanner);
if (!rootDictionary.ContainsKey(NameToken.Type) && isLenientParsing)
{