ImageGear .NET improves the overall size of saved PDF documents by reducing or removing data structures in a PDF document.
File size improvements will vary with each PDF file. In some cases, file size reduction is dramatic. By default, ImageGear .NET removes standard fonts embedded in a PDF document for additional compression benefits. Re-saving an optimized PDF file is not expected to further reduce its size. Less frequently, PDF file size may increase due to metadata that is always written when PDF documents are saved.
To compress a PDF document using ImageGear .NET:
The following is a sample method that illustrates how to re-compress a PDF file to memory:
Refer to the sample SaveCompressedPDF for a more complete example of re-saving PDF files (see PDF Samples).
ImageGear .NET provides below options to control compression:
Downsampling replaces higher resolution images with lower resolution equivalents when visual quality is not too severely reduced. The process of downsampling will reduce the number of pixels in an image.
This option is enabled by default.
If the PDF is intended to be viewed at large magnification values, then disable this option:
Use JBIG2 lossless generic compression when the content of the image is unknown.
Use JBIG2 lossless text compression when the content of the image is known to contain text or symbols, since it can provide greater compression than JBIG2 lossless generic.
Use JBIG2 lossy text compression when the content of the image is known to contain only text or symbols, since it can provide even greater compression than JBIG2 lossless text with low risk of introducing errors.
ImGearCompressOptions uses JPEG compression by default. The compression level can be controlled (or disabled) by setting RecompressImageJpegCompressionLevel to one of the following five values: None, LossyLow, LossyMedium, LossyHigh, LossyMaximum.
JPEG2000 compression must be enabled by setting the RecompressUsingJpeg2K property to true. The compression level can be controlled by setting RecompressImageJpeg2kCompressionLevel to one of the following five values: Lossless, LossyMinimum, LossyLow, LossyMedium, LossyHigh, LossyMaximum.
When enabled, all metadata streams, except for the document's main metadata stream located in the catalog dictionary, are removed.
This option is disabled by default.
When enabled, image thumbnails are removed from all pages of the document.
This option is disabled by default.