diff --git a/examples/Program.cs b/examples/Program.cs index 00e9136a..108128d6 100644 --- a/examples/Program.cs +++ b/examples/Program.cs @@ -51,7 +51,7 @@ 8, ("Extract Words with newline detection (example with algorithm). Issue 512", () => OpenDocumentAndExtractWords.Run(Path.Combine(filesDirectory, "OPEN.RABBIT.ENGLISH.LOP.pdf"))) - } + } }; var choices = string.Join(Environment.NewLine, examples.Select(x => $"{x.Key}: {x.Value.name}")); diff --git a/src/UglyToad.PdfPig/Content/Pages.cs b/src/UglyToad.PdfPig/Content/Pages.cs index 93f60603..8d25b2db 100644 --- a/src/UglyToad.PdfPig/Content/Pages.cs +++ b/src/UglyToad.PdfPig/Content/Pages.cs @@ -21,6 +21,12 @@ this.pdfScanner = pdfScanner ?? throw new ArgumentNullException(nameof(pdfScanner)); Count = catalog.PagesDictionary.GetIntOrDefault(NameToken.Count); + var CountOfPagesByPagesTree = catalog.PageTree.Children.Count; + if (Count != CountOfPagesByPagesTree) + { + //log.Warning($"Dicrionary Page Count {Count} different to discovered pages {CountOfPagesByPagesTree}. Using {CountOfPagesByPagesTree}."); + Count = CountOfPagesByPagesTree; + } } public Page GetPage(int pageNumber, InternalParsingOptions parsingOptions)