diff --git a/src/UglyToad.PdfPig/Parser/FileStructure/FirstPassParser.cs b/src/UglyToad.PdfPig/Parser/FileStructure/FirstPassParser.cs index 07802351..a0b847e3 100644 --- a/src/UglyToad.PdfPig/Parser/FileStructure/FirstPassParser.cs +++ b/src/UglyToad.PdfPig/Parser/FileStructure/FirstPassParser.cs @@ -153,6 +153,23 @@ internal static partial class FirstPassParser { results.Add(table); nextLocation = table.GetPrevious(); + + // Also add any optional associated Stream + var xRefStm = table.GetXRefStm(); + if (xRefStm is long xRefStmValue) + { + var stream = GetXrefStreamOrTable( + offset, + input, + scanner, + xRefStmValue, + log); + + if (stream != null) + { + results.Add(stream); + } + } } else if (streamOrTable is XrefStream stream) { diff --git a/src/UglyToad.PdfPig/Parser/FileStructure/XrefTable.cs b/src/UglyToad.PdfPig/Parser/FileStructure/XrefTable.cs index c02a1aa8..011b25ba 100644 --- a/src/UglyToad.PdfPig/Parser/FileStructure/XrefTable.cs +++ b/src/UglyToad.PdfPig/Parser/FileStructure/XrefTable.cs @@ -44,4 +44,14 @@ internal sealed class XrefTable : IXrefSection return null; } + + public long? GetXRefStm() + { + if (Dictionary != null && Dictionary.TryGet(NameToken.XrefStm, out NumericToken xRefStm)) + { + return xRefStm.Long; + } + + return null; + } } \ No newline at end of file