Skip to content

Commit

Permalink
Correctly parse FunctionBasedShading matrix and fix #702
Browse files Browse the repository at this point in the history
  • Loading branch information
BobLd committed Nov 12, 2023
1 parent 17d50f0 commit 62bc32a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Binary file not shown.
10 changes: 10 additions & 0 deletions src/UglyToad.PdfPig.Tests/Integration/ShadingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

public class ShadingTests
{
[Fact]
public void Issue702()
{
// Placeholder test for issue 702, the document contains a FunctionBasedShading
using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("PDFBOX-1869-4-1.pdf")))
{
var page1 = document.GetPage(1);
}
}

[Fact]
public void AxialRadial1()
{
Expand Down
2 changes: 1 addition & 1 deletion src/UglyToad.PdfPig/Util/ShadingParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private static FunctionBasedShading CreateFunctionBasedShading(DictionaryToken s
}

TransformationMatrix matrix;
if (shadingDictionary.TryGet<ArrayToken>(NameToken.Coords, scanner, out var matrixToken))
if (shadingDictionary.TryGet<ArrayToken>(NameToken.Matrix, scanner, out var matrixToken))
{
matrix = TransformationMatrix.FromArray(matrixToken.Data.OfType<NumericToken>().Select(n => n.Data).ToArray());
}
Expand Down

0 comments on commit 62bc32a

Please sign in to comment.