Nutrient .NET SDK

Compress PDFs in C# with 30+ optimization parameters

  • MRC hyper-compression for mixed-content documents — text, graphics, and images compressed separately with the optimal algorithm
  • JBIG2 and JPEG2000 image compression with automatic color detection
  • Remove annotations, bookmarks, metadata, blank pages, embedded files, and JavaScript to minimize file size
  • Linearize PDFs for fast web viewing and parallel processing for faster batch compression

Need pricing or implementation help? Talk to Sales.

PDF COMPRESSION IN C#

using GdPicturePDFReducer gdpicturePDFReducer = new GdPicturePDFReducer();
// Remove unused document content.
gdpicturePDFReducer.PDFReducerConfiguration.RemoveAnnotations = true;
gdpicturePDFReducer.PDFReducerConfiguration.RemoveBookmarks = true;
gdpicturePDFReducer.PDFReducerConfiguration.RemoveMetadata = true;
gdpicturePDFReducer.PDFReducerConfiguration.RemoveBlankPages = true;
// Optimize fonts and document structure.
gdpicturePDFReducer.PDFReducerConfiguration.PackFonts = true;
gdpicturePDFReducer.PDFReducerConfiguration.PackDocument = true;
// Run the compression process.
gdpicturePDFReducer.ProcessDocument(@"C:\temp\source.pdf", @"C:\temp\output.pdf");

USE CASES

When developers reach for this SDK

Shrink PDFs for storage and transmission

Large PDF archives consume expensive storage and slow down file transfers. The SDK removes redundant data, downscales images, and packs fonts to reduce file size without manual intervention.

Compress scanned document archives

Scanned PDFs tend to be large because they store images rather than text. MRC hyper-compression segments each page into layers and applies the best algorithm to each, cutting file sizes dramatically.

Optimize image-heavy documents

High-resolution images embedded in PDFs are a common source of bloat. Downscale to a target DPI, apply JPEG2000 or JBIG2 compression, and control quality per document — all in a few lines of C#.

Linearize for fast web delivery

Documents served over the web benefit from linearization, which restructures PDFs so pages load incrementally as they download. Enable it with a single configuration flag.

PDF compression capabilities for .NET

General optimization

Remove unnecessary content and optimize document structure. Pack fonts and the document itself to eliminate redundant data.


  • Remove annotations, bookmarks, and metadata
  • Strip embedded files, form fields, and JavaScript
  • Pack fonts and document structure to reduce overhead

Image recompression

Recompress existing images in a PDF at a lower resolution and configurable quality level. The target DPI and quality are set independently.


  • Downscale images to a target DPI
  • Control image quality, from low to lossless
  • Automatic color detection selects the best codec per image

Advanced image compression

Apply JBIG2 for bitonal images and JPEG2000 for color and grayscale. Automatic color detection picks the right scheme without manual configuration.


  • JBIG2 for black-and-white and bitonal content
  • JPEG2000 for 24-bit color and 8-bit grayscale images
  • Configurable JBIG2 threshold for lossy/lossless tradeoff

MRC hyper-compression

Mixed raster content compression segments pages into text, graphics, and image layers, and then applies the optimal algorithm to each independently.


  • Designed for mixed-content documents like scanned contracts
  • Reduces file size without visible quality loss
  • Configurable background layer downscale resolution


ADVANCED CAPABILITIES

Beyond basic compression

The SDK exposes 30+ configuration parameters. Stack techniques — remove content, recompress images, apply MRC, and linearize in a single compression pass. Multicore parallelization processes pages concurrently without any extra code.

Illustration of PDF compression in a .NET environment
Stack multiple techniques

Combine content removal, image recompression, font packing, MRC, and linearization in a single compression pass — all controlled through one configuration object.


Parallel processing

The SDK allocates threads dynamically based on available CPU resources, speeding up compression of large documents and batch jobs.


Configurable output PDF version

Choose the output PDF version and conformance level, or retain the existing version of the source document.


VB.NET support

All compression features are available in VB.NET with the same API surface. The guides include complete code examples in both C# and VB.NET.


Frequently asked questions

How do I compress a PDF in C#?

Install the Nutrient .NET SDK, configure the compression settings, and point the optimizer at the source and output file paths. You can combine techniques — remove content, recompress images, pack fonts — in a single pass. See the compression guide for complete C# examples.

What is MRC compression and when should I use it?

Mixed raster content (MRC) compression segments each page into layers — text, graphics, and background images — and applies the optimal algorithm to each. It’s most effective for documents that mix text and images, such as scanned contracts, reports with charts, or invoices. See the MRC guide.

How do I recompress images in a PDF with C#?

Configure the SDK to recompress existing images at a target resolution and quality level. You control both the target DPI and image quality independently. Reducing unnecessarily high image resolution is one of the most effective ways to cut file size without visible quality loss.

What is the difference between JBIG2 and JPEG2000?

JBIG2 is designed for bitonal (black-and-white) images and achieves very high compression ratios on scanned text. JPEG2000 is suited for 24-bit color and 8-bit grayscale images, offering better quality than standard JPEG at the same file size. Enable color detection to let the SDK choose automatically.

How do I linearize a PDF for fast web viewing in C#?

Enable linearization in the configuration before running the optimizer. Linearization restructures the PDF so a viewer can display the first page before the rest of the file has finished downloading — useful for large documents served over the web.

What content can I remove to reduce PDF file size?

The SDK can remove annotations, bookmarks, metadata, embedded files, form fields, hyperlinks, JavaScript, blank pages, and page thumbnails — each controlled independently. Content removal is fast and often produces meaningful size reductions on its own.

Does the SDK support parallel processing for batch compression?

Yes. Parallel processing is on by default. The SDK dynamically allocates threads based on available CPU resources, so batch compression jobs scale without additional configuration.

Can I use the compression SDK with VB.NET?

Yes. All compression features are available in VB.NET with the same options. The compression guide includes complete code examples in both C# and VB.NET.


FREE TRIAL

Ready to get started?

Start compressing PDFs in C# in minutes — 30+ optimization parameters, no payment information required.