C# code tutorial

PDF Processing & Editing PDF Creating & Inserting PDF to Image PDF Digital Signature PDF Extracting PDF Protecting PDF Chart PDF Barcode

Popular .NET SDK

PDF Compressor is to reduce the size of your PDFs and maintain good quality.

PDF compression is the reduction in size of PDF data in order to save space or transmission time, it contains content and image condense and decrease. To PDF files, compression main refers to image compressing.

While embedding external data structure in PDF, XsPDF control will always apply LZW compression to compact the data size. Bilevel images (monochrome) will be compressed using FAX encoding (CCITT) and/or LZW encoding. Other images use LZW encoding.

Using this PDF document compressing .NET control, developers can easily and quickly complete a high-quality PDF document compression programmatically. Following C# demo code is a solution to make optimization on text and image.

// Open the original pdf file
PdfDocument document = PdfReader.Open("file1.pdf", PdfDocumentOpenMode.Modify);

// Compress content streams of PDF pages.
document.Options.CompressContentStreams = true;

// You can set modes for best compression (slower) or best speed (larger files).
document.Options.FlateEncodeMode = PdfFlateEncodeMode.BestCompression;

// Compress JPEG images with the FlateDecode filter.
document.Options.UseFlateDecoderForJpegImages = PdfUseFlateDecoderForJpegImages.Always;

// Save and show the document           

More Excel tutorial