mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-19 10:47:56 +08:00
handle stream length being an object stream value
This commit is contained in:
@@ -535,6 +535,18 @@
|
||||
// We can only find it if we know where it is.
|
||||
if (objectLocationProvider.TryGetOffset(lengthReference.Data, out var offset))
|
||||
{
|
||||
if (offset < 0)
|
||||
{
|
||||
var result = GetObjectFromStream(lengthReference.Data, offset);
|
||||
|
||||
if (!(result.Data is NumericToken streamLengthToken))
|
||||
{
|
||||
throw new PdfDocumentFormatException($"Could not locate the length object with offset {offset} which should have been in a stream." +
|
||||
$" Found: {result.Data}.");
|
||||
}
|
||||
|
||||
return streamLengthToken.Long;
|
||||
}
|
||||
// Move to the length object and read it.
|
||||
Seek(offset);
|
||||
|
||||
|
Reference in New Issue
Block a user