fix bug with endstream appearing without line break

This commit is contained in:
Eliot Jones
2018-01-20 11:53:24 +00:00
parent c5e3ce7ec7
commit 3d2a66cbf9
2 changed files with 5 additions and 9 deletions

View File

@@ -3,9 +3,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using IO;
using PdfPig.ContentStream; using PdfPig.ContentStream;
using PdfPig.Tokenization.Scanner; using PdfPig.Tokenization.Scanner;
using PdfPig.Tokenization.Tokens; using PdfPig.Tokenization.Tokens;
using PdfPig.Util;
using Xunit; using Xunit;
public class PdfTokenScannerTests public class PdfTokenScannerTests
@@ -294,8 +296,9 @@ endobj
<< /S 1245 >> << /S 1245 >>
stream stream
%¥×³®í»š}%§X{{tøNåÝž¶ö¢ÖÞgrehtyyy$&%&£$££(*¾–~´¼
endstream endstream
endstream endobj";
var scanner = GetScanner(s); var scanner = GetScanner(s);

View File

@@ -214,16 +214,9 @@
// We are reading 'end' (possibly). // We are reading 'end' (possibly).
if (commonPartPosition < commonPart.Length && inputBytes.CurrentByte == commonPart[commonPartPosition]) if (commonPartPosition < commonPart.Length && inputBytes.CurrentByte == commonPart[commonPartPosition])
{
if (commonPartPosition == 0 && !ReadHelper.IsWhitespace(previousByte))
{
// We've just encountered a normal 'e' in the stream.
}
else
{ {
commonPartPosition++; commonPartPosition++;
} }
}
else if (commonPartPosition == commonPart.Length) else if (commonPartPosition == commonPart.Length)
{ {
// We are reading 'stream' after 'end' // We are reading 'stream' after 'end'