PdfSaveSanitizer Class

Repairs harmless issues of a file that some readers handle badly (PdfSanitizerRepairKind), with one incremental update that keeps the bytes of the file: a file that has none of the issues is returned as it is.

public static class PdfSaveSanitizer

Methods

NameDescription
Sanitize(ReadOnlyMemory<byte>, PdfReadOptions?)Repairs a file.

Sanitize(ReadOnlyMemory<byte>, PdfReadOptions?)

PdfSaveSanitizer.cs

Repairs a file.

public static PdfSanitizationResult Sanitize(ReadOnlyMemory<byte> file, PdfReadOptions? options = null)

Parameters

file ReadOnlyMemory<byte>
The file.
options PdfReadOptions?
The options to read the file with, or null for the default options.

Returns

PdfSanitizationResult The repaired file and the repairs.

Exceptions

PdfException
The file cannot be read.
InvalidOperationException
The file needs repairs, and is damaged: the reader repaired its structure, so it cannot be updated incrementally.