PdfReadOptions Class

The options of PdfDocument.Open. The limits bound the memory and the work of hostile files.

public sealed class PdfReadOptions

Constructors

NameDescription
PdfReadOptions()

PdfReadOptions()

PdfReadOptions.cs
public PdfReadOptions()

No documentation is available.

Properties

NameDescription
AllowFullDownloadGets a value indicating whether a document opened over HTTP (PdfDocument.OpenAsync) can download the whole file: to repair a damaged file, which scans it, or to look for a header beyond the first kilobyte. When it is false, such a file throws UnsupportedPdfFeatureException. The default is true.
CertificateGets the certificate, with its private key, of a recipient of a document encrypted for certificates (the public-key security handler, /Adobe.PubSec). The default is null.
DefaultGets the default options.
LoadAllObjectsGets a value indicating whether the document reads all its objects, its page tree and the data of its streams when it is opened, so that PdfDocument.Diagnostics lists every problem of the file (PdfDocument.ValidateStructure). The default is false: the objects are read when they are first used.
MaxDecodedStreamLengthGets the maximum length of the decoded data of one stream, in bytes. The default is 256 MiB.
MaxNestingDepthGets the maximum depth of nested arrays and dictionaries. The default is 256.
PasswordGets the password of an encrypted document: the user or the owner password. The default is the empty password.

AllowFullDownload

PdfReadOptions.cs

Gets a value indicating whether a document opened over HTTP (PdfDocument.OpenAsync) can download the whole file: to repair a damaged file, which scans it, or to look for a header beyond the first kilobyte. When it is false, such a file throws UnsupportedPdfFeatureException. The default is true.

public bool AllowFullDownload { get; init; }

Property value

bool

Gets the certificate, with its private key, of a recipient of a document encrypted for certificates (the public-key security handler, /Adobe.PubSec). The default is null.

public X509Certificate2? Certificate { get; init; }

Property value

X509Certificate2?

Gets the default options.

public static PdfReadOptions Default { get; }

Property value

PdfReadOptions

LoadAllObjects

PdfReadOptions.cs

Gets a value indicating whether the document reads all its objects, its page tree and the data of its streams when it is opened, so that PdfDocument.Diagnostics lists every problem of the file (PdfDocument.ValidateStructure). The default is false: the objects are read when they are first used.

public bool LoadAllObjects { get; init; }

Property value

bool

MaxDecodedStreamLength

PdfReadOptions.cs

Gets the maximum length of the decoded data of one stream, in bytes. The default is 256 MiB.

public long MaxDecodedStreamLength { get; init; }

Property value

long

Exceptions

ArgumentOutOfRangeException
The value is not positive.

MaxNestingDepth

PdfReadOptions.cs

Gets the maximum depth of nested arrays and dictionaries. The default is 256.

public int MaxNestingDepth { get; init; }

Property value

int

Exceptions

ArgumentOutOfRangeException
The value is not positive.

Gets the password of an encrypted document: the user or the owner password. The default is the empty password.

public string? Password { get; init; }

Property value

string?