mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-22 12:09:50 +08:00
support streams containing only carriage returns. handle comments in arrays and dictionaries
* while the pdf specification says stream data should follow a newline following a stream operator some files have only a carriage return following the stream operator. * since comment tokens may appear inside an array or dictionary we ignore them if they occur here since they will break interpretation of the dictionary or array contents.
This commit is contained in:
@@ -229,14 +229,22 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
// While the specification demands a \n we have seen files with \r only in the wild.
|
||||
var hadWhiteSpace = false;
|
||||
if (inputBytes.CurrentByte == '\r')
|
||||
{
|
||||
hadWhiteSpace = true;
|
||||
inputBytes.MoveNext();
|
||||
}
|
||||
|
||||
if (inputBytes.CurrentByte != '\n')
|
||||
{
|
||||
return false;
|
||||
if (!hadWhiteSpace)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inputBytes.Seek(inputBytes.CurrentOffset - 1);
|
||||
}
|
||||
|
||||
// Store where we started reading the first byte of data.
|
||||
|
Reference in New Issue
Block a user