From 4f55ff61bacd74378fe959644d857e5ec46043f3 Mon Sep 17 00:00:00 2001 From: Morten Nilsen Date: Tue, 14 Jul 2026 09:24:57 +0200 Subject: [PATCH] Normalize Dublin Core in PdfNormalizer PdfNormalizer zeroed the xmp:CreateDate/ModifyDate/MetadataDate elements but not the Dublin Core element. Apache FOP writes the render timestamp into , so the #pdf snapshot target (added in #516) was non-deterministic for FOP-produced PDFs while the sibling dates were neutralized. Adds to the normalized set plus a focused test. --- src/Tests/PdfNormalizerTests.cs | 10 ++++++++++ src/Verify.DocNet/PdfNormalizer.cs | 1 + 2 files changed, 11 insertions(+) diff --git a/src/Tests/PdfNormalizerTests.cs b/src/Tests/PdfNormalizerTests.cs index c57ed74..37aa347 100644 --- a/src/Tests/PdfNormalizerTests.cs +++ b/src/Tests/PdfNormalizerTests.cs @@ -28,6 +28,16 @@ public void NeutralizesVolatileValues() Assert.That(Normalize(input), Is.EqualTo(expected)); } + [Test] + public void NeutralizesDublinCoreDate() + { + // Some producers (for example Apache FOP) write the render time into the Dublin Core + // element, a volatile per-render value like its xmp:* date siblings. + var input = "2024-01-15T09:30:00+05:30"; + var expected = "0000-00-00T00:00:00+00:00"; + Assert.That(Normalize(input), Is.EqualTo(expected)); + } + [Test] public void CollapsesDifferingValuesToTheSameOutput() { diff --git a/src/Verify.DocNet/PdfNormalizer.cs b/src/Verify.DocNet/PdfNormalizer.cs index d85d37c..69a3a29 100644 --- a/src/Verify.DocNet/PdfNormalizer.cs +++ b/src/Verify.DocNet/PdfNormalizer.cs @@ -42,6 +42,7 @@ public static void Normalize(byte[] data) ZeroXmpElement(data, "