From a80abfb358a86bad83e4ac4aa6632b45fe278390 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Wed, 21 Oct 2026 08:35:58 +1100 Subject: [PATCH 1/2] Omit the pdf Producer from snapshots The Producer names the library and version that wrote the pdf, so it changes whenever that library is upgraded rather than when the document does. --- src/Directory.Build.props | 2 +- src/StaticSettingsTests/OutputsTests.PngOnly.verified.txt | 3 +-- src/Tests/Samples.ExcludePdfDocument.verified.txt | 3 +-- src/Tests/Samples.MultiPage.verified.txt | 3 +-- src/Tests/Samples.PageTextPerPage.verified.txt | 3 +-- src/Tests/Samples.PagesToInclude.verified.txt | 3 +-- src/Tests/Samples.SkipPdfNormalization.verified.txt | 3 +-- src/Tests/Samples.StripPdfEmbeddedFonts.verified.txt | 3 +-- src/Tests/Samples.TextOnly.verified.txt | 3 +-- src/Tests/Samples.VerifyPdf.verified.txt | 3 +-- src/Tests/Samples.VerifyPdfStream.verified.txt | 3 +-- ...s.NormalizedSnapshotHoldsTheNeutralizedBytes.verified.txt | 3 +-- ...onTests.SkippedSnapshotHoldsTheProducerBytes.verified.txt | 3 +-- ...dedFontsTests.PagesAreRenderedWithTheirFonts.verified.txt | 3 +-- src/Verify.PDFium/PdfProperties.cs | 5 +++++ 15 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c6b025a..f25a53e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;CS0649;CA1416;NU1608;NU1109 - 2.1.0 + 2.2.0 14.0 1.0.0 PDF, PDFium, Verify diff --git a/src/StaticSettingsTests/OutputsTests.PngOnly.verified.txt b/src/StaticSettingsTests/OutputsTests.PngOnly.verified.txt index a450242..5db2e22 100644 --- a/src/StaticSettingsTests/OutputsTests.PngOnly.verified.txt +++ b/src/StaticSettingsTests/OutputsTests.PngOnly.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/Samples.ExcludePdfDocument.verified.txt b/src/Tests/Samples.ExcludePdfDocument.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/Samples.ExcludePdfDocument.verified.txt +++ b/src/Tests/Samples.ExcludePdfDocument.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/Samples.MultiPage.verified.txt b/src/Tests/Samples.MultiPage.verified.txt index 185682c..a7fb680 100644 --- a/src/Tests/Samples.MultiPage.verified.txt +++ b/src/Tests/Samples.MultiPage.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 4, Pages: [ diff --git a/src/Tests/Samples.PageTextPerPage.verified.txt b/src/Tests/Samples.PageTextPerPage.verified.txt index a450242..5db2e22 100644 --- a/src/Tests/Samples.PageTextPerPage.verified.txt +++ b/src/Tests/Samples.PageTextPerPage.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/Samples.PagesToInclude.verified.txt b/src/Tests/Samples.PagesToInclude.verified.txt index b0735dd..12c6c4f 100644 --- a/src/Tests/Samples.PagesToInclude.verified.txt +++ b/src/Tests/Samples.PagesToInclude.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 4, Pages: [ diff --git a/src/Tests/Samples.SkipPdfNormalization.verified.txt b/src/Tests/Samples.SkipPdfNormalization.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/Samples.SkipPdfNormalization.verified.txt +++ b/src/Tests/Samples.SkipPdfNormalization.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/Samples.StripPdfEmbeddedFonts.verified.txt b/src/Tests/Samples.StripPdfEmbeddedFonts.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/Samples.StripPdfEmbeddedFonts.verified.txt +++ b/src/Tests/Samples.StripPdfEmbeddedFonts.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/Samples.TextOnly.verified.txt b/src/Tests/Samples.TextOnly.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/Samples.TextOnly.verified.txt +++ b/src/Tests/Samples.TextOnly.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/Samples.VerifyPdf.verified.txt b/src/Tests/Samples.VerifyPdf.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/Samples.VerifyPdf.verified.txt +++ b/src/Tests/Samples.VerifyPdf.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/Samples.VerifyPdfStream.verified.txt b/src/Tests/Samples.VerifyPdfStream.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/Samples.VerifyPdfStream.verified.txt +++ b/src/Tests/Samples.VerifyPdfStream.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/SkipPdfNormalizationTests.NormalizedSnapshotHoldsTheNeutralizedBytes.verified.txt b/src/Tests/SkipPdfNormalizationTests.NormalizedSnapshotHoldsTheNeutralizedBytes.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/SkipPdfNormalizationTests.NormalizedSnapshotHoldsTheNeutralizedBytes.verified.txt +++ b/src/Tests/SkipPdfNormalizationTests.NormalizedSnapshotHoldsTheNeutralizedBytes.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/SkipPdfNormalizationTests.SkippedSnapshotHoldsTheProducerBytes.verified.txt b/src/Tests/SkipPdfNormalizationTests.SkippedSnapshotHoldsTheProducerBytes.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/SkipPdfNormalizationTests.SkippedSnapshotHoldsTheProducerBytes.verified.txt +++ b/src/Tests/SkipPdfNormalizationTests.SkippedSnapshotHoldsTheProducerBytes.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Tests/StripPdfEmbeddedFontsTests.PagesAreRenderedWithTheirFonts.verified.txt b/src/Tests/StripPdfEmbeddedFontsTests.PagesAreRenderedWithTheirFonts.verified.txt index 4234bc0..caae983 100644 --- a/src/Tests/StripPdfEmbeddedFontsTests.PagesAreRenderedWithTheirFonts.verified.txt +++ b/src/Tests/StripPdfEmbeddedFontsTests.PagesAreRenderedWithTheirFonts.verified.txt @@ -2,8 +2,7 @@ Document: { CreationDate: DateTimeOffset_1, Creator: Morph, - ModDate: DateTimeOffset_1, - Producer: PDFsharp 6.2.4 + ModDate: DateTimeOffset_1 }, PageCount: 1, Pages: [ diff --git a/src/Verify.PDFium/PdfProperties.cs b/src/Verify.PDFium/PdfProperties.cs index c678660..ea92b3d 100644 --- a/src/Verify.PDFium/PdfProperties.cs +++ b/src/Verify.PDFium/PdfProperties.cs @@ -16,6 +16,11 @@ static class PdfProperties var result = new Dictionary(properties.Count); foreach (var (key, value) in properties) { + if (key == "Producer") + { + continue; + } + if (key is "CreationDate" or "ModDate" && PdfDate.TryParse(value, out var date)) { From e593353d606c42774607d4a3c50cbb146b2633d5 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Wed, 21 Oct 2026 10:25:32 +1100 Subject: [PATCH 2/2] Bump DeterministicPdf to 2.3.0 2.3.0 removes the Producer from the pdf snapshot too, so it no longer changes with the library that wrote the document, and repairs offsets in cross-reference streams and incremental updates, so documents of those shapes are now fully normalized. Each changed .verified.pdf is exactly what 2.3.0 produces from the previous one. --- src/Directory.Packages.props | 2 +- .../OutputsTests.PngOnly.verified.pdf | Bin 10756 -> 10728 bytes src/Tests/Samples.MultiPage.verified.pdf | Bin 16707 -> 16679 bytes .../Samples.PageTextPerPage.verified.pdf | Bin 10756 -> 10728 bytes src/Tests/Samples.PagesToInclude.verified.pdf | Bin 16707 -> 16679 bytes ...Samples.StripPdfEmbeddedFonts.verified.pdf | Bin 3603 -> 3575 bytes src/Tests/Samples.TextOnly.verified.pdf | Bin 10756 -> 10728 bytes src/Tests/Samples.VerifyPdf.verified.pdf | Bin 10756 -> 10728 bytes .../Samples.VerifyPdfStream.verified.pdf | Bin 10756 -> 10728 bytes ...pshotHoldsTheNeutralizedBytes.verified.pdf | Bin 10756 -> 10728 bytes ...agesAreRenderedWithTheirFonts.verified.pdf | Bin 3603 -> 3575 bytes 11 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 4306192..a7cf18d 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -4,7 +4,7 @@ true - + diff --git a/src/StaticSettingsTests/OutputsTests.PngOnly.verified.pdf b/src/StaticSettingsTests/OutputsTests.PngOnly.verified.pdf index 9a25f4809b19aae1baf846d070aadde5a401eda3..b7d5eacc54bc8a1d308acee969f7a85f129ddb9e 100644 GIT binary patch delta 241 zcmZn(c@aDzcVjiPGLxD4<_2YM#?3QTZZg*!87LTlfI^-E7nosSU}#~8A!cN3gdt{P zVvZqZ4m1hfJaZFFF-s#$usUxfiw%uUF)TJTv%s(f=ssg~ODqkHOefoD?&mbK;8Im} I^>^a}076qTB>(^b delta 271 zcmaD6+!8V&moLD@tvDmGs6fF?&q&W?V=l8YlZD~tB4utyG^x$CDmR(yjZG8`KtLf+ zfeXwqFfg<<#Sk+xF~bluF*C#vGdILE&)gJK%+kadtk)aKVnbsy42uoT4KOS*v@kM9 Yx7gCa*mAOh=6+5~GcHwCSARDy0D~nu9RL6T diff --git a/src/Tests/Samples.MultiPage.verified.pdf b/src/Tests/Samples.MultiPage.verified.pdf index 974b9e29177dee206417aab7b6acdfd8c2953f7b..2496ad850ccfe9ef9771487b0723adb65c180629 100644 GIT binary patch delta 365 zcmX@y#JIePaYF9K>Qk0XX6BpSt+*LCCs^NPt~WAJFaQCCJOwT=!@$7M!Vp8u$kZ4^ z%*4zBUChwf*c4OD98=8H%ml2i9?4=OLjy~6%|@n{<``n;Mi`DUvNXZ)h_SgjhIz)8 ymS)K2xq$p^Vqt_~iK&4J#Dz!>G_|lmx7g6c!qjYXwZlFx14~OTRaIAiH!c9>{z{_& delta 381 zcmZ49#CW)gaY8O%fQwskMq*Kcf|;I?p2^1CQj3=PqZ zFfupBu-?eh6vOGp=9b3jdQA)r4KTzkOfc*)H82G`Nd-A9Of4+YEjBc^a}076qTB>(^b delta 271 zcmaD6+!8V&moLD@tvDmGs6fF?&q&W?V=l8YlZD~tB4utyG^x$CDmR(yjZG8`KtLf+ zfeXwqFfg<<#Sk+xF~bluF*C#vGdILE&)gJK%+kadtk)aKVnbsy42uoT4KOS*v@kM9 Yx7gCa*mAOh=6+5~GcHwCSARDy0D~nu9RL6T diff --git a/src/Tests/Samples.PagesToInclude.verified.pdf b/src/Tests/Samples.PagesToInclude.verified.pdf index 974b9e29177dee206417aab7b6acdfd8c2953f7b..2496ad850ccfe9ef9771487b0723adb65c180629 100644 GIT binary patch delta 365 zcmX@y#JIePaYF9K>Qk0XX6BpSt+*LCCs^NPt~WAJFaQCCJOwT=!@$7M!Vp8u$kZ4^ z%*4zBUChwf*c4OD98=8H%ml2i9?4=OLjy~6%|@n{<``n;Mi`DUvNXZ)h_SgjhIz)8 ymS)K2xq$p^Vqt_~iK&4J#Dz!>G_|lmx7g6c!qjYXwZlFx14~OTRaIAiH!c9>{z{_& delta 381 zcmZ49#CW)gaY8O%fQwskMq*Kcf|;I?p2^1CQj3=PqZ zFfupBu-?eh6vOGp=9b3jdQA)r4KTzkOfc*)H82G`Nd-A9Of4+YEjBce6j)WK28%8E>%@me>W}w4JkRA diff --git a/src/Tests/Samples.TextOnly.verified.pdf b/src/Tests/Samples.TextOnly.verified.pdf index 9a25f4809b19aae1baf846d070aadde5a401eda3..b7d5eacc54bc8a1d308acee969f7a85f129ddb9e 100644 GIT binary patch delta 241 zcmZn(c@aDzcVjiPGLxD4<_2YM#?3QTZZg*!87LTlfI^-E7nosSU}#~8A!cN3gdt{P zVvZqZ4m1hfJaZFFF-s#$usUxfiw%uUF)TJTv%s(f=ssg~ODqkHOefoD?&mbK;8Im} I^>^a}076qTB>(^b delta 271 zcmaD6+!8V&moLD@tvDmGs6fF?&q&W?V=l8YlZD~tB4utyG^x$CDmR(yjZG8`KtLf+ zfeXwqFfg<<#Sk+xF~bluF*C#vGdILE&)gJK%+kadtk)aKVnbsy42uoT4KOS*v@kM9 Yx7gCa*mAOh=6+5~GcHwCSARDy0D~nu9RL6T diff --git a/src/Tests/Samples.VerifyPdf.verified.pdf b/src/Tests/Samples.VerifyPdf.verified.pdf index 9a25f4809b19aae1baf846d070aadde5a401eda3..b7d5eacc54bc8a1d308acee969f7a85f129ddb9e 100644 GIT binary patch delta 241 zcmZn(c@aDzcVjiPGLxD4<_2YM#?3QTZZg*!87LTlfI^-E7nosSU}#~8A!cN3gdt{P zVvZqZ4m1hfJaZFFF-s#$usUxfiw%uUF)TJTv%s(f=ssg~ODqkHOefoD?&mbK;8Im} I^>^a}076qTB>(^b delta 271 zcmaD6+!8V&moLD@tvDmGs6fF?&q&W?V=l8YlZD~tB4utyG^x$CDmR(yjZG8`KtLf+ zfeXwqFfg<<#Sk+xF~bluF*C#vGdILE&)gJK%+kadtk)aKVnbsy42uoT4KOS*v@kM9 Yx7gCa*mAOh=6+5~GcHwCSARDy0D~nu9RL6T diff --git a/src/Tests/Samples.VerifyPdfStream.verified.pdf b/src/Tests/Samples.VerifyPdfStream.verified.pdf index 9a25f4809b19aae1baf846d070aadde5a401eda3..b7d5eacc54bc8a1d308acee969f7a85f129ddb9e 100644 GIT binary patch delta 241 zcmZn(c@aDzcVjiPGLxD4<_2YM#?3QTZZg*!87LTlfI^-E7nosSU}#~8A!cN3gdt{P zVvZqZ4m1hfJaZFFF-s#$usUxfiw%uUF)TJTv%s(f=ssg~ODqkHOefoD?&mbK;8Im} I^>^a}076qTB>(^b delta 271 zcmaD6+!8V&moLD@tvDmGs6fF?&q&W?V=l8YlZD~tB4utyG^x$CDmR(yjZG8`KtLf+ zfeXwqFfg<<#Sk+xF~bluF*C#vGdILE&)gJK%+kadtk)aKVnbsy42uoT4KOS*v@kM9 Yx7gCa*mAOh=6+5~GcHwCSARDy0D~nu9RL6T diff --git a/src/Tests/SkipPdfNormalizationTests.NormalizedSnapshotHoldsTheNeutralizedBytes.verified.pdf b/src/Tests/SkipPdfNormalizationTests.NormalizedSnapshotHoldsTheNeutralizedBytes.verified.pdf index 9a25f4809b19aae1baf846d070aadde5a401eda3..b7d5eacc54bc8a1d308acee969f7a85f129ddb9e 100644 GIT binary patch delta 241 zcmZn(c@aDzcVjiPGLxD4<_2YM#?3QTZZg*!87LTlfI^-E7nosSU}#~8A!cN3gdt{P zVvZqZ4m1hfJaZFFF-s#$usUxfiw%uUF)TJTv%s(f=ssg~ODqkHOefoD?&mbK;8Im} I^>^a}076qTB>(^b delta 271 zcmaD6+!8V&moLD@tvDmGs6fF?&q&W?V=l8YlZD~tB4utyG^x$CDmR(yjZG8`KtLf+ zfeXwqFfg<<#Sk+xF~bluF*C#vGdILE&)gJK%+kadtk)aKVnbsy42uoT4KOS*v@kM9 Yx7gCa*mAOh=6+5~GcHwCSARDy0D~nu9RL6T diff --git a/src/Tests/StripPdfEmbeddedFontsTests.PagesAreRenderedWithTheirFonts.verified.pdf b/src/Tests/StripPdfEmbeddedFontsTests.PagesAreRenderedWithTheirFonts.verified.pdf index 11c6917bb17c2289baa992bef7c0a1207000893d..1937627953201d24be0d7fad13df65696e69a34a 100644 GIT binary patch delta 241 zcmbO%^IdvE?#60ib|y3P%@f$U88@%wxXD~^WT0RG0t$HwTwsQQfuV&VhM1AD5r&wF zi8+RtInX3@^UO^!#VidW=6NGoY-nt3g09)n%p60rp}D0QhB^y#e6j)WK28%8E>%@me>W}w4JkRA