mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 09:37:44 +08:00
Only reset missed attempts count if table is found in CrossReferenceParser.Parse() and fix #1047
This commit is contained in:
parent
ca9f70ffb0
commit
5b566b53da
@ -7,6 +7,15 @@
|
||||
|
||||
public class GithubIssuesTests
|
||||
{
|
||||
[Fact]
|
||||
public void Issue1047()
|
||||
{
|
||||
var path = IntegrationHelpers.GetSpecificTestDocumentPath("Hang.pdf");
|
||||
|
||||
var ex = Assert.Throws<PdfDocumentFormatException>(() => PdfDocument.Open(path, new ParsingOptions() { UseLenientParsing = true }));
|
||||
Assert.Equal("The cross reference was not found.", ex.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Issue1048()
|
||||
{
|
||||
|
||||
Binary file not shown.
@ -10,7 +10,7 @@
|
||||
using Tokenization.Scanner;
|
||||
using Tokens;
|
||||
|
||||
internal class CrossReferenceParser
|
||||
internal sealed class CrossReferenceParser
|
||||
{
|
||||
private readonly ILog log;
|
||||
private readonly XrefOffsetValidator offsetValidator;
|
||||
@ -151,8 +151,6 @@
|
||||
{
|
||||
log.Debug("Element was cross reference stream.");
|
||||
|
||||
missedAttempts = 0;
|
||||
|
||||
// Unread the numeric token.
|
||||
tokenScanner.Seek(previousCrossReferenceLocation);
|
||||
|
||||
@ -169,6 +167,8 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
missedAttempts = 0;
|
||||
|
||||
table.Add(tablePart);
|
||||
|
||||
previousCrossReferenceLocation = tablePart.Previous;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user