Class CompareOptions
Controls which aspects of two PDF documents are compared and the tolerances applied.
Inherited Members
Namespace: DRIT.Pdf.Comparison
Assembly: DRIT.Pdf.dll
Syntax
public sealed class CompareOptions
Properties
ColorTolerance
Per-channel colour tolerance in the 0–1 range used when comparing RGB values.
A value of 0.0 (default) requires exact equality via
Equals(PdfColor).
Declaration
public double ColorTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
CompareImageBytes
When true and CompareImages is also enabled, the raw rendering bytes of matched image elements are compared byte-for-byte. This is expensive for large documents; disabled by default.
Declaration
public bool CompareImageBytes { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CompareImages
Whether to compare image elements on each page. Default is true.
Declaration
public bool CompareImages { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CompareMetadata
Whether to compare document-level metadata (Title, Author, …). Default is true.
Declaration
public bool CompareMetadata { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CompareOutlines
Whether to compare document outlines (bookmarks). Default is true.
Declaration
public bool CompareOutlines { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ComparePaths
Whether to compare path (vector graphic) elements on each page. Default is true.
Declaration
public bool ComparePaths { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CompareText
Whether to compare text content elements on each page. Default is true.
Declaration
public bool CompareText { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CompareTextPositions
Whether matched text elements are compared for positional movement. Default is true. Set to false only for fixtures whose contract deliberately excludes cross-producer paragraph flow.
Declaration
public bool CompareTextPositions { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CoordinateTolerance
Maximum distance (in PDF user-space points) by which two element centres may
differ and still be considered the same element. Default is 0.5 pt.
Declaration
public double CoordinateTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
FontSizeTolerance
Maximum difference in font size (points) that is still considered equal.
Default is 0.01 pt.
Declaration
public double FontSizeTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
IgnorePath
Optional predicate for path content that should be excluded from comparison. The predicate receives the zero-based page index and path element.
Declaration
public Func<int, ReadablePathContent, bool>? IgnorePath { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<int, ReadablePathContent, bool> |
IgnoreText
Optional predicate for content text that should be excluded from comparison. The predicate receives the zero-based page index and text element.
Declaration
public Func<int, TextContent, bool>? IgnoreText { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<int, TextContent, bool> |
IgnoreTextPosition
Optional predicate for text-position differences that are known producer noise. The predicate receives the zero-based page index and the matched text elements from the two documents. Returning true suppresses only the positional difference; text content and formatting are still compared.
Declaration
public Func<int, TextContent, TextContent, bool>? IgnoreTextPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<int, TextContent, TextContent, bool> |
SuppressFullPageBackgroundPaths
When true, path elements whose bounding box covers at least 90% of the page in both dimensions are silently excluded from path comparison. These are typically white background rectangles that PDF generators such as Microsoft Word emit behind every page and that have no visible effect. Default is false.
Declaration
public bool SuppressFullPageBackgroundPaths { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
TextRunMergeGapTolerance
Maximum horizontal gap, in points, between same-style text fragments that may
be merged during text normalization. Default is 3.0 pt.
Declaration
public double TextRunMergeGapTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
TextRunMergeOverlapTolerance
Maximum horizontal overlap, in points, between same-style text fragments that
may still be merged during text normalization. Default is 2.5 pt.
Declaration
public double TextRunMergeOverlapTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| double |