Table of Contents

Class PdfSnapshotOptions

Namespace
PDiffy
Assembly
PDiffy.dll

What to leave out of a snapshot, or change in it, for content a test doesn't care about. Ignored sections still print their header with "(ignored)" under it, and the snapshot's first lines list what was ignored and which pages were kept.

public sealed class PdfSnapshotOptions
Inheritance
PdfSnapshotOptions
Inherited Members

Methods

Check(PdfCheckSet)

Records what a set of checks finds in a checks section, so the findings are approved with the snapshot: a new problem fails the test, and a fixed one fails it too until the snapshot is accepted. Each line is the rule, the page and the path, with no message text. The checks look at the whole document; OnlyPages(params int[]) narrows their findings, and Ignore(params PdfSection[]) doesn't change them.

public PdfSnapshotOptions Check(PdfCheckSet set)

Parameters

set PdfCheckSet

The rules to apply, such as Latest.

Returns

PdfSnapshotOptions

Directory(string)

The folder for this snapshot, instead of Directory. Only the Snapshot.Verify methods use it.

public PdfSnapshotOptions Directory(string directory)

Parameters

directory string

Returns

PdfSnapshotOptions

Ignore(params PdfDetail[])

Leaves a detail out wherever it appears, such as Positions or Colors.

public PdfSnapshotOptions Ignore(params PdfDetail[] details)

Parameters

details PdfDetail[]

Returns

PdfSnapshotOptions

Ignore(params PdfSection[])

Leaves whole sections out, such as Metadata.

public PdfSnapshotOptions Ignore(params PdfSection[] sections)

Parameters

sections PdfSection[]

Returns

PdfSnapshotOptions

Name(string)

The snapshot's file name without extension, instead of one from the test file and method, such as "TrailMapTests.TrailMap_ShouldMatch". Only the Snapshot.Verify methods use it.

public PdfSnapshotOptions Name(string name)

Parameters

name string

Returns

PdfSnapshotOptions

OnlyPages(params int[])

Keeps only what is on these pages, numbered from 1. A structure element or bookmark is kept when it, or anything under it, is on one of them. The document's page count, page labels and fonts are still printed for the whole file.

public PdfSnapshotOptions OnlyPages(params int[] pages)

Parameters

pages int[]

Returns

PdfSnapshotOptions

ScrubDates()

Replaces dates in quoted text with Date_1, Date_2 and so on. The same text always gets the same token, so a test can still see that two dates match. Recognizes 2026-10-27, 10/27/2026, October 27, 2026 and 27 Oct 2026, each with an optional time, and PDF dates such as D:20261027120000.

public PdfSnapshotOptions ScrubDates()

Returns

PdfSnapshotOptions

ScrubGuids()

Replaces GUIDs in quoted text with Guid_1, Guid_2 and so on. The same text always gets the same token.

public PdfSnapshotOptions ScrubGuids()

Returns

PdfSnapshotOptions

ScrubText(Regex, string)

Replaces matches in quoted text (element text, alt text, titles, link addresses, form values and so on). The replacement can refer to groups, such as "Permit $1".

public PdfSnapshotOptions ScrubText(Regex pattern, string replacement)

Parameters

pattern Regex
replacement string

Returns

PdfSnapshotOptions

ShowProducerAndCreator()

Prints the producer and creator (the libraries and application that wrote the PDF), which a snapshot normally records only as present or missing because they change with every upgrade.

public PdfSnapshotOptions ShowProducerAndCreator()

Returns

PdfSnapshotOptions

Tolerate(PdfTolerance, double)

Lets a number differ by up to points without failing the test, so a value that rounds the other way after a library update passes while a real move still fails. A run within the tolerance passes and leaves the verified file as it is. The snapshot's header lists each tolerance, such as "# tolerances: positions 1pt".

public PdfSnapshotOptions Tolerate(PdfTolerance tolerance, double points)

Parameters

tolerance PdfTolerance
points double

Returns

PdfSnapshotOptions

Use(PdfProfile)

Leaves out what a profile leaves out, such as Accessibility. Further Ignore calls leave out more.

public PdfSnapshotOptions Use(PdfProfile profile)

Parameters

profile PdfProfile

Returns

PdfSnapshotOptions

Variant(string)

Added to the name, default or not, as {name}.{variant}, so each row of a theory gets its own snapshot and keeps the test's name: o => o.Variant(trail). Only the Snapshot.Verify methods use it.

public PdfSnapshotOptions Variant(string variant)

Parameters

variant string

Returns

PdfSnapshotOptions