From 696ad947da322b80c04af035ac5c126524b5760f Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Thu, 26 Mar 2026 09:52:52 -0400 Subject: [PATCH 1/6] Fix EPS protocol violations in PostscriptQRCode: remove showpage and setpagedevice from EPS output --- QRCoder/PostscriptQRCode.cs | 59 ++++++++++++++----- ...nder_postscript_qrcode_colors.approved.txt | 18 +++--- ..._render_postscript_qrcode_eps.approved.txt | 21 +++---- ...nder_postscript_qrcode_simple.approved.txt | 18 +++--- ...render_postscript_qrcode_size.approved.txt | 18 +++--- ...pt_qrcode_size_no_quiet_zones.approved.txt | 18 +++--- 6 files changed, 88 insertions(+), 64 deletions(-) diff --git a/QRCoder/PostscriptQRCode.cs b/QRCoder/PostscriptQRCode.cs index 99f86065..b01d4e39 100644 --- a/QRCoder/PostscriptQRCode.cs +++ b/QRCoder/PostscriptQRCode.cs @@ -101,15 +101,17 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d var drawableModulesCount = QrCodeData.ModuleMatrix.Count - (drawQuietZones ? 0 : offset * 2); var pointsPerModule = (double)Math.Min(viewBox.Width, viewBox.Height) / (double)drawableModulesCount; - var estimatedCapacity = PS_HEADER.Length + PS_FUNCTIONS.Length + PS_FOOTER.Length + + var header = epsFormat ? EPS_HEADER : PS_HEADER; + var footer = epsFormat ? EPS_FOOTER : PS_FOOTER; + + var estimatedCapacity = header.Length + PS_FUNCTIONS.Length + footer.Length + (drawableModulesCount * drawableModulesCount * 2) + // modules (either "f " or "b ") drawableModulesCount * 3 + // newlines ("nl\n") 200; // embedded numbers var sb = new StringBuilder(estimatedCapacity); - sb.AppendFormat(CultureInfo.InvariantCulture, PS_HEADER, [ - CleanSvgVal(viewBox.Width), CleanSvgVal(pointsPerModule), - epsFormat ? "EPSF-3.0" : string.Empty + sb.AppendFormat(CultureInfo.InvariantCulture, header, [ + CleanSvgVal(viewBox.Width), CleanSvgVal(pointsPerModule) ]); sb.AppendFormat(CultureInfo.InvariantCulture, PS_FUNCTIONS, [ CleanSvgVal(darkColor.R /255.0), CleanSvgVal(darkColor.G /255.0), CleanSvgVal(darkColor.B /255.0), @@ -127,7 +129,7 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d } } sb.Append('\n'); - sb.Append(PS_FOOTER); + sb.Append(footer); return sb.ToString(); } @@ -140,15 +142,17 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d // Note: line terminations here will encode differently based on which platform QRCoder was compiled on (CRLF vs LF); // however, PostScript interpreters should handle both equally well. + + // Standard PostScript header — includes media/page setup and setpagedevice (valid for standalone PS documents). private const string PS_HEADER = """ - %!PS-Adobe-3.0 {2} + %!PS-Adobe-3.0 %%Creator: QRCoder.NET %%Title: QRCode %%DocumentData: Clean7Bit %%Origin: 0 %%DocumentMedia: Default {0} {0} 0 () () %%BoundingBox: 0 0 {0} {0} - %%LanguageLevel: 2 + %%LanguageLevel: 2 %%Pages: 1 %%Page: 1 1 %%EndComments @@ -162,8 +166,26 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d """; + // EPS header — omits %%DocumentMedia, %%Pages, %%Page, and setpagedevice, all of which are + // forbidden or inappropriate in Encapsulated PostScript (Adobe Technical Note #5002). + private const string EPS_HEADER = """ + %!PS-Adobe-3.0 EPSF-3.0 + %%Creator: QRCoder.NET + %%Title: QRCode + %%DocumentData: Clean7Bit + %%Origin: 0 + %%BoundingBox: 0 0 {0} {0} + %%LanguageLevel: 2 + %%EndComments + %%BeginConstants + /sz {0} def + /sc {1} def + %%EndConstants + + """; + private const string PS_FUNCTIONS = """ - %%BeginFunctions + %%BeginFunctions /csquare {{ newpath 0 0 moveto @@ -174,15 +196,15 @@ 1 0 rlineto setrgbcolor fill }} def - /f {{ + /f {{ {0} {1} {2} csquare 1 0 translate }} def - /b {{ + /b {{ 1 0 translate - }} def - /background {{ - {3} {4} {5} csquare + }} def + /background {{ + {3} {4} {5} csquare }} def /nl {{ -{6} -1 translate @@ -200,10 +222,19 @@ sc sc scale """; + // Standard PostScript footer — showpage is required for standalone PS documents. private const string PS_FOOTER = """ %%EndBody grestore - showpage + showpage + %%EOF + + """; + + // EPS footer — showpage is forbidden in EPS files (Adobe Technical Note #5002). + private const string EPS_FOOTER = """ + %%EndBody + grestore %%EOF """; diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_colors.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_colors.approved.txt index 60e52670..0e27a8f8 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_colors.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_colors.approved.txt @@ -1,11 +1,11 @@ -%!PS-Adobe-3.0 +%!PS-Adobe-3.0 %%Creator: QRCoder.NET %%Title: QRCode %%DocumentData: Clean7Bit %%Origin: 0 %%DocumentMedia: Default 165 165 0 () () %%BoundingBox: 0 0 165 165 -%%LanguageLevel: 2 +%%LanguageLevel: 2 %%Pages: 1 %%Page: 1 1 %%EndComments @@ -16,7 +16,7 @@ %%BeginFeature: *PageSize Default << /PageSize [ sz sz ] /ImagingBBox null >> setpagedevice %%EndFeature -%%BeginFunctions +%%BeginFunctions /csquare { newpath 0 0 moveto @@ -27,15 +27,15 @@ setrgbcolor fill } def -/f { +/f { 1 0 0 csquare 1 0 translate } def -/b { +/b { 1 0 translate -} def -/background { - 0 0 1 csquare +} def +/background { + 0 0 1 csquare } def /nl { -33 -1 translate @@ -85,5 +85,5 @@ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b nl b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b %%EndBody grestore -showpage +showpage %%EOF diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt index 6a4b0410..22a6bee6 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt @@ -3,20 +3,14 @@ %%Title: QRCode %%DocumentData: Clean7Bit %%Origin: 0 -%%DocumentMedia: Default 165 165 0 () () %%BoundingBox: 0 0 165 165 -%%LanguageLevel: 2 -%%Pages: 1 -%%Page: 1 1 +%%LanguageLevel: 2 %%EndComments %%BeginConstants /sz 165 def /sc 5 def %%EndConstants -%%BeginFeature: *PageSize Default -<< /PageSize [ sz sz ] /ImagingBBox null >> setpagedevice -%%EndFeature -%%BeginFunctions +%%BeginFunctions /csquare { newpath 0 0 moveto @@ -27,15 +21,15 @@ setrgbcolor fill } def -/f { +/f { 0 0 0 csquare 1 0 translate } def -/b { +/b { 1 0 translate -} def -/background { - 1 1 1 csquare +} def +/background { + 1 1 1 csquare } def /nl { -33 -1 translate @@ -85,5 +79,4 @@ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b nl b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b %%EndBody grestore -showpage %%EOF diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_simple.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_simple.approved.txt index 0fd16ade..1b66e490 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_simple.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_simple.approved.txt @@ -1,11 +1,11 @@ -%!PS-Adobe-3.0 +%!PS-Adobe-3.0 %%Creator: QRCoder.NET %%Title: QRCode %%DocumentData: Clean7Bit %%Origin: 0 %%DocumentMedia: Default 165 165 0 () () %%BoundingBox: 0 0 165 165 -%%LanguageLevel: 2 +%%LanguageLevel: 2 %%Pages: 1 %%Page: 1 1 %%EndComments @@ -16,7 +16,7 @@ %%BeginFeature: *PageSize Default << /PageSize [ sz sz ] /ImagingBBox null >> setpagedevice %%EndFeature -%%BeginFunctions +%%BeginFunctions /csquare { newpath 0 0 moveto @@ -27,15 +27,15 @@ setrgbcolor fill } def -/f { +/f { 0 0 0 csquare 1 0 translate } def -/b { +/b { 1 0 translate -} def -/background { - 1 1 1 csquare +} def +/background { + 1 1 1 csquare } def /nl { -33 -1 translate @@ -85,5 +85,5 @@ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b nl b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b %%EndBody grestore -showpage +showpage %%EOF diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size.approved.txt index 709bc3a1..25dc3f7d 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size.approved.txt @@ -1,11 +1,11 @@ -%!PS-Adobe-3.0 +%!PS-Adobe-3.0 %%Creator: QRCoder.NET %%Title: QRCode %%DocumentData: Clean7Bit %%Origin: 0 %%DocumentMedia: Default 33 33 0 () () %%BoundingBox: 0 0 33 33 -%%LanguageLevel: 2 +%%LanguageLevel: 2 %%Pages: 1 %%Page: 1 1 %%EndComments @@ -16,7 +16,7 @@ %%BeginFeature: *PageSize Default << /PageSize [ sz sz ] /ImagingBBox null >> setpagedevice %%EndFeature -%%BeginFunctions +%%BeginFunctions /csquare { newpath 0 0 moveto @@ -27,15 +27,15 @@ setrgbcolor fill } def -/f { +/f { 0 0 0 csquare 1 0 translate } def -/b { +/b { 1 0 translate -} def -/background { - 1 1 1 csquare +} def +/background { + 1 1 1 csquare } def /nl { -33 -1 translate @@ -85,5 +85,5 @@ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b nl b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b %%EndBody grestore -showpage +showpage %%EOF diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size_no_quiet_zones.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size_no_quiet_zones.approved.txt index cc78b5a0..1ed6e783 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size_no_quiet_zones.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_size_no_quiet_zones.approved.txt @@ -1,11 +1,11 @@ -%!PS-Adobe-3.0 +%!PS-Adobe-3.0 %%Creator: QRCoder.NET %%Title: QRCode %%DocumentData: Clean7Bit %%Origin: 0 %%DocumentMedia: Default 50 50 0 () () %%BoundingBox: 0 0 50 50 -%%LanguageLevel: 2 +%%LanguageLevel: 2 %%Pages: 1 %%Page: 1 1 %%EndComments @@ -16,7 +16,7 @@ %%BeginFeature: *PageSize Default << /PageSize [ sz sz ] /ImagingBBox null >> setpagedevice %%EndFeature -%%BeginFunctions +%%BeginFunctions /csquare { newpath 0 0 moveto @@ -27,15 +27,15 @@ setrgbcolor fill } def -/f { +/f { 0 0 0 csquare 1 0 translate } def -/b { +/b { 1 0 translate -} def -/background { - 1 1 1 csquare +} def +/background { + 1 1 1 csquare } def /nl { -25 -1 translate @@ -77,5 +77,5 @@ f b b b b b f b f f f f b f f b b f b b f f f b b nl f f f f f f f b f b b b b f b b b f f b b b f f f %%EndBody grestore -showpage +showpage %%EOF From dc92dd11f4b901a9f7eeedd4068c6a8054071d3b Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Thu, 26 Mar 2026 10:09:01 -0400 Subject: [PATCH 2/6] Update TransposeVerificationTests postscript approval file for EPS/PS format fixes --- ...ationTests.postscript_renderer.approved.ps | Bin 2599 -> 2588 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/QRCoderTests/TransposeVerificationTests.postscript_renderer.approved.ps b/QRCoderTests/TransposeVerificationTests.postscript_renderer.approved.ps index 52ac1b8ceecbda1be2135bae4cf3f469d1eb4582..389449adf51a1854f615936b26554b8a5c894702 100644 GIT binary patch delta 103 zcmZ23GDn0@RWTq~*D)nODOJ~4&tM||l8IZcP3~swoGi+uZ^5Mi1cnL*3MEB}dBr)2 zC8=Ds3Mr{+T>43g$=T^e`K5U&3e`|mhCr3c#f7DbMX8$`nC7yxbE&Gj`nz!f0Bh17 AjQ{`u delta 98 zcmbOuvRs5;RWTq~*D)nODOJ~4&p=@!-x5ZJiJPu5DopNR>;#g6O!`35fk{GHflEIr sF*!TED8Do>MWI@OO92QB!7#bFur#qKRbg`l(_D6tIG3ubtG^o;06NPV>;M1& From 5b7ca44f2faef4c8eb423a497ef388d665f874b0 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Thu, 26 Mar 2026 10:34:42 -0400 Subject: [PATCH 3/6] Improve EPS DSC compliance: use standard prolog/setup sections and fix current-point leak --- QRCoder/PostscriptQRCode.cs | 58 ++++++++++++++++--- ..._render_postscript_qrcode_eps.approved.txt | 14 ++--- 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/QRCoder/PostscriptQRCode.cs b/QRCoder/PostscriptQRCode.cs index b01d4e39..cfa14fcf 100644 --- a/QRCoder/PostscriptQRCode.cs +++ b/QRCoder/PostscriptQRCode.cs @@ -102,9 +102,10 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d var pointsPerModule = (double)Math.Min(viewBox.Width, viewBox.Height) / (double)drawableModulesCount; var header = epsFormat ? EPS_HEADER : PS_HEADER; + var functions = epsFormat ? EPS_FUNCTIONS : PS_FUNCTIONS; var footer = epsFormat ? EPS_FOOTER : PS_FOOTER; - var estimatedCapacity = header.Length + PS_FUNCTIONS.Length + footer.Length + + var estimatedCapacity = header.Length + functions.Length + footer.Length + (drawableModulesCount * drawableModulesCount * 2) + // modules (either "f " or "b ") drawableModulesCount * 3 + // newlines ("nl\n") 200; // embedded numbers @@ -113,10 +114,11 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d sb.AppendFormat(CultureInfo.InvariantCulture, header, [ CleanSvgVal(viewBox.Width), CleanSvgVal(pointsPerModule) ]); - sb.AppendFormat(CultureInfo.InvariantCulture, PS_FUNCTIONS, [ + sb.AppendFormat(CultureInfo.InvariantCulture, functions, [ CleanSvgVal(darkColor.R /255.0), CleanSvgVal(darkColor.G /255.0), CleanSvgVal(darkColor.B /255.0), CleanSvgVal(lightColor.R /255.0), CleanSvgVal(lightColor.G /255.0), CleanSvgVal(lightColor.B /255.0), - drawableModulesCount + drawableModulesCount, + CleanSvgVal(viewBox.Width), CleanSvgVal(pointsPerModule) ]); for (int xi = offset; xi < offset + drawableModulesCount; xi++) @@ -168,6 +170,7 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d // EPS header — omits %%DocumentMedia, %%Pages, %%Page, and setpagedevice, all of which are // forbidden or inappropriate in Encapsulated PostScript (Adobe Technical Note #5002). + // Constants (sz, sc) and procedure definitions are emitted in EPS_FUNCTIONS below. private const string EPS_HEADER = """ %!PS-Adobe-3.0 EPSF-3.0 %%Creator: QRCoder.NET @@ -177,10 +180,6 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d %%BoundingBox: 0 0 {0} {0} %%LanguageLevel: 2 %%EndComments - %%BeginConstants - /sz {0} def - /sc {1} def - %%EndConstants """; @@ -222,6 +221,51 @@ sc sc scale """; + // EPS variant: uses standard DSC %%BeginProlog/%%EndProlog for procedure definitions, + // %%BeginSetup/%%EndSetup for constants, and moves 0 0 moveto inside gsave so it does + // not leak the current point into the surrounding document. + private const string EPS_FUNCTIONS = """ + %%BeginProlog + /csquare {{ + newpath + 0 0 moveto + 0 1 rlineto + 1 0 rlineto + 0 -1 rlineto + closepath + setrgbcolor + fill + }} def + /f {{ + {0} {1} {2} csquare + 1 0 translate + }} def + /b {{ + 1 0 translate + }} def + /background {{ + {3} {4} {5} csquare + }} def + /nl {{ + -{6} -1 translate + }} def + %%EndProlog + %%BeginSetup + /sz {7} def + /sc {8} def + %%EndSetup + %%BeginBody + gsave + 0 0 moveto + sz sz scale + background + grestore + gsave + sc sc scale + 0 {6} 1 sub translate + + """; + // Standard PostScript footer — showpage is required for standalone PS documents. private const string PS_FOOTER = """ %%EndBody diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt index 22a6bee6..7de24e0a 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt @@ -6,11 +6,7 @@ %%BoundingBox: 0 0 165 165 %%LanguageLevel: 2 %%EndComments -%%BeginConstants -/sz 165 def -/sc 5 def -%%EndConstants -%%BeginFunctions +%%BeginProlog /csquare { newpath 0 0 moveto @@ -34,10 +30,14 @@ /nl { -33 -1 translate } def -%%EndFunctions +%%EndProlog +%%BeginSetup +/sz 165 def +/sc 5 def +%%EndSetup %%BeginBody -0 0 moveto gsave +0 0 moveto sz sz scale background grestore From a520e930ff448c5ecd82c7875741d2ac634a43cf Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Thu, 26 Mar 2026 10:43:15 -0400 Subject: [PATCH 4/6] Use private dictionary in EPS prolog to prevent name collisions in host document --- QRCoder/PostscriptQRCode.cs | 5 +++-- ...ndererTests.can_render_postscript_qrcode_eps.approved.txt | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/QRCoder/PostscriptQRCode.cs b/QRCoder/PostscriptQRCode.cs index cfa14fcf..bf4cef13 100644 --- a/QRCoder/PostscriptQRCode.cs +++ b/QRCoder/PostscriptQRCode.cs @@ -226,6 +226,7 @@ sc sc scale // not leak the current point into the surrounding document. private const string EPS_FUNCTIONS = """ %%BeginProlog + 5 dict begin /csquare {{ newpath 0 0 moveto @@ -254,7 +255,6 @@ 1 0 translate /sz {7} def /sc {8} def %%EndSetup - %%BeginBody gsave 0 0 moveto sz sz scale @@ -276,9 +276,10 @@ sc sc scale """; // EPS footer — showpage is forbidden in EPS files (Adobe Technical Note #5002). + // 'end' pops the private dictionary pushed in %%BeginProlog to avoid polluting the host dict stack. private const string EPS_FOOTER = """ - %%EndBody grestore + end %%EOF """; diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt index 7de24e0a..beb5b8b3 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt @@ -7,6 +7,7 @@ %%LanguageLevel: 2 %%EndComments %%BeginProlog +5 dict begin /csquare { newpath 0 0 moveto @@ -35,7 +36,6 @@ /sz 165 def /sc 5 def %%EndSetup -%%BeginBody gsave 0 0 moveto sz sz scale @@ -77,6 +77,6 @@ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b nl b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b nl b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b nl b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b -%%EndBody grestore +end %%EOF From ab32b8c6f02815200516658991b54c3e8c9f1e87 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Thu, 26 Mar 2026 10:53:42 -0400 Subject: [PATCH 5/6] Remove %%Origin from EPS header (not applicable to EPS files) --- QRCoder/PostscriptQRCode.cs | 1 - ...deRendererTests.can_render_postscript_qrcode_eps.approved.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/QRCoder/PostscriptQRCode.cs b/QRCoder/PostscriptQRCode.cs index bf4cef13..11a21195 100644 --- a/QRCoder/PostscriptQRCode.cs +++ b/QRCoder/PostscriptQRCode.cs @@ -176,7 +176,6 @@ public string GetGraphic(Size viewBox, Color darkColor, Color lightColor, bool d %%Creator: QRCoder.NET %%Title: QRCode %%DocumentData: Clean7Bit - %%Origin: 0 %%BoundingBox: 0 0 {0} {0} %%LanguageLevel: 2 %%EndComments diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt index beb5b8b3..91579a81 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt @@ -2,7 +2,6 @@ %%Creator: QRCoder.NET %%Title: QRCode %%DocumentData: Clean7Bit -%%Origin: 0 %%BoundingBox: 0 0 165 165 %%LanguageLevel: 2 %%EndComments From 306d3b40f87a41cf42e018ec73fdaac3a9594f02 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Thu, 26 Mar 2026 11:00:24 -0400 Subject: [PATCH 6/6] Fix EPS private dictionary size from 5 to 7 (includes sz and sc) --- QRCoder/PostscriptQRCode.cs | 2 +- ...eRendererTests.can_render_postscript_qrcode_eps.approved.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/QRCoder/PostscriptQRCode.cs b/QRCoder/PostscriptQRCode.cs index 11a21195..03c47ef3 100644 --- a/QRCoder/PostscriptQRCode.cs +++ b/QRCoder/PostscriptQRCode.cs @@ -225,7 +225,7 @@ sc sc scale // not leak the current point into the surrounding document. private const string EPS_FUNCTIONS = """ %%BeginProlog - 5 dict begin + 7 dict begin /csquare {{ newpath 0 0 moveto diff --git a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt index 91579a81..e73fdf96 100644 --- a/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt +++ b/QRCoderTests/PostscriptQRCodeRendererTests.can_render_postscript_qrcode_eps.approved.txt @@ -6,7 +6,7 @@ %%LanguageLevel: 2 %%EndComments %%BeginProlog -5 dict begin +7 dict begin /csquare { newpath 0 0 moveto