Class PdfValidator
Namespace: AdCodicem.Pdf.Validation
Assembly: AdCodicem.Pdf.dll
Validates documents against a profile, and says what is wrong with them — separately from whether they could be read at all.
public sealed class PdfValidator
Inheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
A validator holds no state beyond its options, so one instance serves any number of threads and can be registered as a singleton. A [PdfDocument](AdCodicem.Pdf.Documents.PdfDocument), on the other hand, belongs to one thread at a time, validation included.
Validation reads through the document like any other caller, lazily and within the document's reader limits: what it resolves joins the document's cache, and what the reader notices on the way joins [PdfDocument.Diagnostics](AdCodicem.Pdf.Documents.PdfDocument#AdCodicem_Pdf_Documents_PdfDocument_Diagnostics). Opening the document with raised limits lets it check more.
Constructors
PdfValidator(PdfValidatorOptions?)
Initializes a validator.
public PdfValidator(PdfValidatorOptions? options = null)
Parameters
options PdfValidatorOptions?
How to validate; PdfValidatorOptions.Default when null.
Properties
Options
Gets how this validator validates.
public PdfValidatorOptions Options { get; }
Property Value
Methods
Validate(PdfDocument)
Validates a document against the profile of PdfValidator.Options.
public PdfValidationReport Validate(PdfDocument document)
Parameters
document PdfDocument
A document the caller opened, and keeps: it is left open.
Returns
What the profile found, which is empty for a sound document.
Remarks
A document the reader could open is reported on, never refused: what is wrong with it is what the report is for.
Exceptions
document is null.
document was disposed.
Validation reached one of the document's reader limits, and the document was opened with PdfReaderOptions.ThrowOnLimit. Without it, a rule reports at most that what the reader cut was not checked whole.