PDF Compression
IronPDF supports compression of PDFs. The way in which the majority of PDF file size can be reduced is by reducing the size of embedding images within the PDF Document. Therefore, we can call the CompressImages
method.
The way resizing JPEGs works, 100% quality has almost no loss, and 1% is a very low-quality output image. Generally speaking, 90% and above are considered high-quality, 80%-90% is considered medium-quality, and 70%-80% is considered low-quality. Reducing below 70% will produce low-quality images, but doing this may reduce the total file size of the PDF Document dramatically.
Please experiment with different values to get a feel for the range of quality versus the file size to get the optimal balance for your requirements. Obviousness of quality reduction ultimately depends on the type of image that was input, and some images may reduce in clarity more significantly than others.
How to Compress PDF in C#
- Install the IronPDF C# Library from NuGet
- Load an existing PDF document to be compressed in C#
- Compress images in PDF utilizing `CompressImages` method
- Specify compression percentage to the method
- Export the reduced size PDF file to the desired directory