MRC Compression in C#

Mixed raster content (MRC) is a way to compress images with mixed content. For more information, see the MRC Wikipedia article.

GdPicture.NET SDK uses advanced MRC compression techniques to reduce the size of structured documents that mix text, graphics, and images, without losing quality.

Our MRC compression engine is based on MRC hyper-compression techniques, and it can both reduce the size of images and improve rendering quality. Using image segmentation, it compresses areas with the optimum algorithm based on their characteristics.

For more information on hyper-compression, check out our demo video below.

Using MRC Compression

To compress a PDF document using MRC compression, follow these steps:

  1. Create a GdPicturePDFReducer object.

  2. Configure the metadata of the resulting PDF document with the following properties of the PDFReducerConfiguration object:

    Property Name Description
    Author Specifies the author of the resulting PDF document.
    Producer Specifies the producer of the resulting PDF document.
    ProducerName Specifies the name of the producer of the resulting PDF document.
    Title Specifies the title of the resulting PDF document.
  3. Enable MRC compression by setting the EnableMRC property of the PDFReducerConfiguration object to true.

  4. Optional: Configure the compression process with the properties of the PDFReducerConfiguration object. For more information, see the compression guide.

  5. Run the compression process with the ProcessDocument method. This method takes the path to the source and the output PDF files as its parameters.

The example below compresses a PDF document using MRC compression:

using GdPicturePDFReducer gdpicturePDFReducer = new GdPicturePDFReducer();

// Configure the metadata of the resulting PDF document.
gdpicturePDFReducer.PDFReducerConfiguration.Author = "GdPicture.NET PDF Reducer SDK";
gdpicturePDFReducer.PDFReducerConfiguration.Producer = "GdPicture.NET 14";
gdpicturePDFReducer.PDFReducerConfiguration.ProducerName = "PSPDFKit";
gdpicturePDFReducer.PDFReducerConfiguration.Title = "MRC Compression";

// Enable and configure MRC compression.
gdpicturePDFReducer.PDFReducerConfiguration.EnableMRC = true;
gdpicturePDFReducer.PDFReducerConfiguration.DownscaleResolutionMRC = 200;
gdpicturePDFReducer.PDFReducerConfiguration.OutputFormat = PDFReducerPDFVersion.PdfVersionRetainExisting;
gdpicturePDFReducer.PDFReducerConfiguration.RecompressImages = true;

// Run the compression process.
gdpicturePDFReducer.ProcessDocument(@"C:\temp\source.pdf", @"C:\temp\output.pdf");
Using gdpicturePDFReducer As GdPicturePDFReducer = New GdPicturePDFReducer()
    'Configure the metadata of the resulting PDF document.
    gdpicturePDFReducer.PDFReducerConfiguration.Author = "GdPicture.NET PDF Reducer SDK"
    gdpicturePDFReducer.PDFReducerConfiguration.Producer = "GdPicture.NET 14"
    gdpicturePDFReducer.PDFReducerConfiguration.ProducerName = "PSPDFKit"
    gdpicturePDFReducer.PDFReducerConfiguration.Title = "MRC Compression"

    'Enable and configure MRC compression.
    gdpicturePDFReducer.PDFReducerConfiguration.EnableMRC = True
    gdpicturePDFReducer.PDFReducerConfiguration.DownscaleResolutionMRC = 200
    gdpicturePDFReducer.PDFReducerConfiguration.OutputFormat = PDFReducerPDFVersion.PdfVersionRetainExisting
    gdpicturePDFReducer.PDFReducerConfiguration.RecompressImages = True

    'Run the compression process.
    gdpicturePDFReducer.ProcessDocument(@"C:\temp\source.pdf", @"C:\temp\output.pdf")
End Using