PdfOptimizationOptions Class

The changes PdfOptimizer.CreatePlan plans. Every change is off by default.

public sealed class PdfOptimizationOptions

Constructors

NameDescription
PdfOptimizationOptions()

PdfOptimizationOptions()

public PdfOptimizationOptions()

No documentation is available.

Properties

NameDescription
AllowSignatureInvalidationGets a value indicating whether the plan may change a document that has signatures. The default is false: PdfOptimizer.Apply refuses to apply a plan that would invalidate them.
CompressStreamsGets a value indicating whether the streams that have no filter are compressed with FlateDecode, when it makes them smaller. A full save with PdfSaveOptions.CompressStreams compresses them too: this matters for an incremental save, or a save that does not compress.
FlattenOptionalContentGets a value indicating whether the optional content (layers) is flattened: the content hidden in the default configuration is removed, the visible content is kept as ordinary content, and the document no longer has layers.
MaxImageResolutionGets the resolution, in pixels per inch, above which the images are resampled to it, or null (the default) to keep the images. The resolution of an image is the highest of its placements on the pages.
PruneUnreachableObjectsGets a value indicating whether the indirect objects that cannot be reached from the trailer are removed. A full save never writes them: this matters for an incremental save, which writes them as free entries.
PruneUnusedResourcesGets a value indicating whether the resources of the pages that their content does not use are removed.
RemoveAttachmentsGets a value indicating whether the embedded files and the file attachment annotations are removed.
RemoveBookmarksGets a value indicating whether the outline (bookmarks) is removed.
RemoveCommentsGets a value indicating whether the comments are removed: the markup annotations (notes, highlights, stamps, drawings...) and their pop-ups.
RemoveFormFieldsGets a value indicating whether the interactive form is removed, with the widgets of its fields. Use PdfInteractiveForm.Flatten to keep the values on the pages.
RemoveJavaScriptGets a value indicating whether JavaScript is removed: the scripts of the document and the actions that run scripts.
RemoveMetadataGets a value indicating whether the document information dictionary and the XMP metadata of the document are removed.
RemoveOpenActionGets a value indicating whether the action run when the document is opened is removed.
RemovePageThumbnailsGets a value indicating whether the thumbnail images of the pages are removed.
RemoveXfaGets a value indicating whether the XFA form is removed; the AcroForm fields are kept.

AllowSignatureInvalidation

PdfOptimizationOptions.cs

Gets a value indicating whether the plan may change a document that has signatures. The default is false: PdfOptimizer.Apply refuses to apply a plan that would invalidate them.

public bool AllowSignatureInvalidation { get; init; }

Property value

bool

Gets a value indicating whether the streams that have no filter are compressed with FlateDecode, when it makes them smaller. A full save with PdfSaveOptions.CompressStreams compresses them too: this matters for an incremental save, or a save that does not compress.

public bool CompressStreams { get; init; }

Property value

bool

FlattenOptionalContent

PdfOptimizationOptions.cs

Gets a value indicating whether the optional content (layers) is flattened: the content hidden in the default configuration is removed, the visible content is kept as ordinary content, and the document no longer has layers.

public bool FlattenOptionalContent { get; init; }

Property value

bool

MaxImageResolution

PdfOptimizationOptions.cs

Gets the resolution, in pixels per inch, above which the images are resampled to it, or null (the default) to keep the images. The resolution of an image is the highest of its placements on the pages.

public double? MaxImageResolution { get; init; }

Property value

double?

Exceptions

ArgumentOutOfRangeException
The value is not positive.

Remarks

The images of 8 bits per component in gray, RGB or an ICC-based color space of 1 or 3 components, without color key mask or decode array, are resampled; the others are kept. A JPEG image is compressed as JPEG again, the others without loss.

PruneUnreachableObjects

PdfOptimizationOptions.cs

Gets a value indicating whether the indirect objects that cannot be reached from the trailer are removed. A full save never writes them: this matters for an incremental save, which writes them as free entries.

public bool PruneUnreachableObjects { get; init; }

Property value

bool

PruneUnusedResources

PdfOptimizationOptions.cs

Gets a value indicating whether the resources of the pages that their content does not use are removed.

public bool PruneUnusedResources { get; init; }

Property value

bool

RemoveAttachments

PdfOptimizationOptions.cs

Gets a value indicating whether the embedded files and the file attachment annotations are removed.

public bool RemoveAttachments { get; init; }

Property value

bool

Gets a value indicating whether the outline (bookmarks) is removed.

public bool RemoveBookmarks { get; init; }

Property value

bool

Gets a value indicating whether the comments are removed: the markup annotations (notes, highlights, stamps, drawings...) and their pop-ups.

public bool RemoveComments { get; init; }

Property value

bool

Gets a value indicating whether the interactive form is removed, with the widgets of its fields. Use PdfInteractiveForm.Flatten to keep the values on the pages.

public bool RemoveFormFields { get; init; }

Property value

bool

Gets a value indicating whether JavaScript is removed: the scripts of the document and the actions that run scripts.

public bool RemoveJavaScript { get; init; }

Property value

bool

Gets a value indicating whether the document information dictionary and the XMP metadata of the document are removed.

public bool RemoveMetadata { get; init; }

Property value

bool

Gets a value indicating whether the action run when the document is opened is removed.

public bool RemoveOpenAction { get; init; }

Property value

bool

RemovePageThumbnails

PdfOptimizationOptions.cs

Gets a value indicating whether the thumbnail images of the pages are removed.

public bool RemovePageThumbnails { get; init; }

Property value

bool

Gets a value indicating whether the XFA form is removed; the AcroForm fields are kept.

public bool RemoveXfa { get; init; }

Property value

bool