Skip to content

# PDFResourceOptimizer

Namespace: O2S.Components.PDF4NET.Core

Provides support for optimizing resource usage in PDF files.

    public class PDFResourceOptimizer

Inheritance Object → PDFResourceOptimizer

Remarks

Usually resources can be optimized after pages from multiple PDF files have been added to a PDF document.

## Constructors

### PDFResourceOptimizer(PDFFixedDocument)

Initializes a new PDFResourceOptimizer object with a PDF document.

    public PDFResourceOptimizer(PDFFixedDocument document)

Parameters

`document` PDFFixedDocument
The document whose resources need to be optimized.

### PDFResourceOptimizer(PDFFileEx)

Initializes a new PDFResourceOptimizer object with a PDF file.

    public PDFResourceOptimizer(PDFFileEx file)

Parameters

`file` PDFFileEx
The PDF file whose resources need to be optimized.

## Methods

### MergeColorspaces()

Scans the file for duplicate colorspaces and merges them.

    public void MergeColorspaces()

Remarks

The method looks for identical PDF colorspace objects and merges them into a single object.

### MergeFonts()

Scans the file for duplicate fonts and merges them.

    public void MergeFonts()

Remarks

The method looks for identical PDF font objects and merges them into a single object.

### MergeGraphicsStates()

Scans the file for duplicate graphics states and merges them.

    public void MergeGraphicsStates()

Remarks

The method looks for identical PDF graphics state objects and merges them into a single object.

### MergeImages()

Scans the file for duplicate images and merges them.

    public void MergeImages()

Remarks

The method looks for identical PDF image objects and merges them into a single object.