Search Results for

    Show / Hide Table of Contents

    Class CompressionMode

    Specifies the compression strategy to use when reducing PDF file size.

    Inheritance
    System.Object
    CompressionMode
    Namespace: IronPdf
    Assembly: IronPdf.dll
    Syntax
    public sealed class CompressionMode : Enum
    Remarks

    Different compression modes balance file size, processing speed, and system resource requirements. Choose the mode that best fits your use case and system constraints.

    Fields

    Automatic

    Automatically selects the optimal compression method based on system capabilities. This is the default and recommended option for most scenarios.

    Declaration
    public const CompressionMode Automatic
    Field Value
    Type Description
    CompressionMode
    Remarks

    Behavior:

    When to Use:

    Recommended for most applications where you want optimal compression but need to handle varying system environments gracefully.

    FastMemory

    Performs compression entirely in memory without any disk I/O operations.

    Declaration
    public const CompressionMode FastMemory
    Field Value
    Type Description
    CompressionMode
    Remarks

    Characteristics:

    • Speed: Fastest compression method
    • Security: No temporary files written to disk
    • File Size: Produces larger files compared to HighQuality (no image resampling/downsampling)
    • Disk I/O: Zero disk access required

    When to Use:

    Limitations:

    Image optimization and JPEG quality settings are not applied in this mode.

    HighQuality

    Applies maximum compression using advanced optimization techniques. Requires temporary disk access but produces the smallest possible file size.

    Declaration
    public const CompressionMode HighQuality
    Field Value
    Type Description
    CompressionMode
    Remarks

    Characteristics:

    • File Size: Smallest output files (maximum compression)
    • Image Optimization: Applies JPEG resampling and downsampling based on quality settings
    • Stream Compression: Uses maximum zlib compression on content streams
    • Disk I/O: Requires writing temporary files to the system temp directory

    When to Use:

    System Requirements:

    Requires write permissions to the system temporary directory. If disk access fails, an exception will be thrown in explicit mode, or automatic fallback to FastMemory occurs in Automatic mode.

    value__

    Declaration
    public int value__
    Field Value
    Type Description
    System.Int32
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    Want to deploy IronPDF to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronPDF free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.