From 1bc0ee71053aedf29fb8e55a26661a04a12a006c Mon Sep 17 00:00:00 2001 From: BobLd <38405645+BobLd@users.noreply.github.com> Date: Mon, 30 Oct 2023 19:31:24 +0000 Subject: [PATCH] Fix type 4 function Copy() stack operator and fix #724 --- .../Integration/ColorSpaceTests.cs | 17 +++++++++++++++++ .../Documents/11194059_2017-11_de_s.pdf | Bin 0 -> 168285 bytes .../Functions/Type4/StackOperators.cs | 16 ++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 src/UglyToad.PdfPig.Tests/Integration/Documents/11194059_2017-11_de_s.pdf diff --git a/src/UglyToad.PdfPig.Tests/Integration/ColorSpaceTests.cs b/src/UglyToad.PdfPig.Tests/Integration/ColorSpaceTests.cs index 1cccd3af5..5fa9acfad 100644 --- a/src/UglyToad.PdfPig.Tests/Integration/ColorSpaceTests.cs +++ b/src/UglyToad.PdfPig.Tests/Integration/ColorSpaceTests.cs @@ -331,6 +331,23 @@ public void SeparationIccColorSpacesWithForm() } } + [Fact] + public void Issue724() + { + // 11194059_2017-11_de_s + var path = IntegrationHelpers.GetDocumentPath("11194059_2017-11_de_s.pdf"); + using (var document = PdfDocument.Open(path)) + { + // Should not throw an exception. + // Fixed an issue in the Type 4 function Copy() StackOperators + Page page1 = document.GetPage(1); + Assert.NotNull(page1); + + Page page2 = document.GetPage(2); + Assert.NotNull(page2); + } + } + private static byte ConvertToByte(double componentValue) { var rounded = Math.Round(componentValue * 255, MidpointRounding.AwayFromZero); diff --git a/src/UglyToad.PdfPig.Tests/Integration/Documents/11194059_2017-11_de_s.pdf b/src/UglyToad.PdfPig.Tests/Integration/Documents/11194059_2017-11_de_s.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ca341934eb09ba8d5dca291b52ce88fae4c9b0cb GIT binary patch literal 168285 zcmbrl1#BhFk~L^%XfreOHQQ}wW@fx*W`;I1wV9cjnVIdj-DYNHc5i=g-t5e1XIH
fcA4-0Yl8lEga18~^|@3oEA{KR+VS
z&h#Hm#Q*a`gkxj>FB_sj6MIvjqLGuW^IwZ1_BO7zcFx4?Oo~oGQ%e&Ud#AsK`1zT{
zEp1$YPE6u9MlQhrSi&SFs>92|!42RP6=CNT5))_RW@8o-69aGvi8BK@ImMX8#ku%-
zSpe)TBI2ClV$33};#_P1E`W%b2%9jAD5ofZTZomNUyn)3&J^gO^EYr#j(-F*dtzqp
zzYZ!h$pY=nT`c}O!1|9nZvPP_7n8ERy$dl5^S`F3{6&YDn}bQ!(*ek&sSGq@($HZh
zW+i6+8^5!Q6VS*O5zb=E*x1zYo1vkxp& ff;fXl)X&-Jj$cn~fM$^;k*UMAu9T_wipfH@>ZWsw