mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-07 16:14:03 +08:00
Add table-xref's associated stream-xrefs
- If an XrefTable has an associated stream, as indicated via the XrefStm-property, then read and add that XrefStream - Any table can have 0 or 1 such associated streams - A caveat: such an associated stream might also theoretically be part of the Parts-sequence in which case it would be encountered both by looping through all those parts along with all the regular tables and now also by association to any of those tables. It doesn't seem harmful since the offsets are flattened eventually anyway and stored by their offset-key into a mapping-table.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user