Handle SetFlatness operator with no value and fix #682

This commit is contained in:
BobLd 2023-08-27 11:05:06 +01:00
parent fe0e4db419
commit f5b4b84dea
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,19 @@
namespace UglyToad.PdfPig.Tests.Integration
{
using Xunit;
public class GamebookTests
{
[Fact]
public void Issue682()
{
using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("Gamebook.pdf")))
{
foreach (var page in document.GetPages())
{
Assert.NotNull(page);
}
}
}
}
}

View File

@ -129,6 +129,10 @@ namespace UglyToad.PdfPig.Graphics
case SetColorRenderingIntent.Symbol:
return new SetColorRenderingIntent((NameToken)operands[0]);
case SetFlatnessTolerance.Symbol:
if (operands.Count == 0)
{
return null; // Should not happen by definition
}
return new SetFlatnessTolerance(OperandToDecimal(operands[0]));
case SetLineCap.Symbol:
return new SetLineCap(OperandToInt(operands[0]));