Skip to content

The dictionary did not contain a number with the key /Size #1078

@jchristn

Description

@jchristn
Unhandled exception. UglyToad.PdfPig.Core.PdfDocumentFormatException: The dictionary did not contain a number with the key /Size. Dictionary way: .
   at UglyToad.PdfPig.Util.DictionaryTokenExtensions.GetInt(DictionaryToken dictionaryToken, NameToken name)
   at UglyToad.PdfPig.CrossReference.TrailerDictionary..ctor(DictionaryToken dictionary, Boolean isLenientParsing)
   at UglyToad.PdfPig.CrossReference.CrossReferenceTableBuilder.Build(Int64 firstCrossReferenceOffset, Int64 offsetCorrection, Boolean isLenientParsing, ILog log)
   at UglyToad.PdfPig.Parser.FileStructure.CrossReferenceParser.Parse(IInputBytes bytes, Boolean isLenientParsing, Int64 crossReferenceLocation, Int64 offsetCorrection, IPdfTokenScanner pdfScanner, ISeekableTokenScanner tokenScanner)
   at UglyToad.PdfPig.Parser.PdfDocumentFactory.OpenDocument(IInputBytes inputBytes, ISeekableTokenScanner scanner, ParsingOptions parsingOptions)
   at UglyToad.PdfPig.Parser.PdfDocumentFactory.Open(IInputBytes inputBytes, ParsingOptions options)
   at UglyToad.PdfPig.Parser.PdfDocumentFactory.Open(Byte[] fileBytes, ParsingOptions options)
   at UglyToad.PdfPig.Parser.PdfDocumentFactory.Open(String filename, ParsingOptions options)
   at UglyToad.PdfPig.PdfDocument.Open(String filePath, ParsingOptions options)

JoyfulMemo_small.pdf

I encounter the above exception when processing the attached file.

I tried with and without explicit ParsingOptions.

ParsingOptions options = new ParsingOptions
{
  SkipMissingFonts = true,
  UseLenientParsing = true
};

using (PdfDocument document = PdfDocument.Open(filename, options))
{
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions