Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle SetFlatness operator with no value and fix #682 #691

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
19 changes: 19 additions & 0 deletions src/UglyToad.PdfPig.Tests/Integration/GamebookTests.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public IGraphicsStateOperation Create(OperatorToken op, IReadOnlyList<IToken> op
case SetColorRenderingIntent.Symbol:
return new SetColorRenderingIntent((NameToken)operands[0]);
case SetFlatnessTolerance.Symbol:
if (operands.Count == 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if there's a way to change this mapping to use new codegen stuff where the input is basically expected args, fallback behavior, expected output or something, to reduce the number of times we need to fix individual ones to be more fault tolerant, ah well, a nice thought experiment, LGTM

{
return null; // Should not happen by definition
}
return new SetFlatnessTolerance(OperandToDecimal(operands[0]));
case SetLineCap.Symbol:
return new SetLineCap(OperandToInt(operands[0]));
Expand Down
Loading