How to Compress PDF Document Image in C#.NET

Complete Guide with C# Demo Codes to Compress PDF Images
Nowadays Portable Document File (PDF) can count as one of the most widely used document file format used for business interaction. Indeed, PDF document can look really fancy and great, especially when you have added plenty of colorful illustrations and graphics into it. However, you might also have noticed that too many images in PDF doc can lead to a slower speed for C# project PDF processing.
Yiigo .NET Image SDK can help you with that issue. C# developers can now use the mature and advanced PDF file compression and editing library component to add powerful and efficient PDF image compressing ability into your Visual C# .NET application.
The most popular PDF compressing functions provided by this Visual C# .NET PDF manipulation DLL component includes two aspects: how to select a proper type of image compression when embedding an image into a PDF document / page in C#, and how to specify a single one or multiple user defined compression type(s) when you are creating a new PDF document with certain image source.
If you are in need of some more PDF processing user manuals in Visual C# .NET application, we have already offered a few here in the following list for your reference.
C# PDF Image Compressing Library Features
  • Advanced image compression technology to compress images in C# PDF document
  • Flexible options to select from different image compression schemes when creating PDF from local or memory images source
  • Support common image compressions with JPEG2000 / Wavelet, JPEG, JBIG2, PNG and many more
  • Lossless PDF image compression for high quality output in C# project
  • Provide seamless integration into Microsoft Visual Studio C# PDF imaging applications
  • Easy to build a Windows PDF application using C# language for PDF image compression
  • Support C# web deployment for PDF document image compressing and editing
  • Compatible with Microsoft Windows XP, Windows 2007 and Windows 2010 operating systems and so on
  • Powerful and complete Visual C# PDF document processing control library SDK
How to Compress Images Within C# PDF
A PDF document with entire text content might bore your readers and tend to be hard to finish. In this case, you might consider adding / inserting some images or pictures into your C#.NET PDF document to better illustrate your point, and also light up your file.
When embedding images in a PDF file, you can select Yiigo .NET Image SDK to achieve that task by applying the Visual C# PDF processing library component, which includes advanced algorithm for you to easily compress the images into your PDF file. Different compression modes are provided to cater to your different needs.
Now you can download the trial and run the exe file to get a valid SDK license. After that, copy the license and all the C#.NET assemblies into your Microsoft Visual Studio PDf image compression application. Then, add needed DLLs to your C# PDF project reference and you are ready to copy the demo code below to your project.
using Yiigo.Image.PDF.dll;
using Yiigo.Image.Process.dll;


static void CompressExistingImages(string fileName, string outputName)
{
using (PdfDocument doc = new PdfDocument(fileName))
{
foreach (PdfImage image in doc.Images)
image.RecompressWithGroup4Fax();

doc.Save(outputName);
}
}
Select C# Compression Scheme to Create PDF with Image
Do you want to directly generate a PDF file with your local or C# program memory images? Yiigo C#.NEt PDF manipulation control library can help you with that. By compressing images to create PDF can greatly release your storage space and improve C# PDF processing speed, because images can occupy a large amount of memory.
When you are creating a PDF document from your local or C# project memory images, such as PNG, JPEG, GIF, TIFF and BMP, you can simply select a compression mode using this library with the Visual C# sample code provided below.
using Yiigo.Image.PDF.dll;
using Yiigo.Image.Process.dll;

// create the PDF converter
PdfConverter pdfConverter = new PdfConverter();
// setup the best image quality and the worst compression
pdfConverter.PdfDocumentOptions.JpegCompressionLevel = 0;

//create a PDF document
Document document = new Document();
document.JpegCompressionLevel = 0;
document.Save(outputName);
Yiigo.Image for C#
Yiigo.Image Plugins
Image Viewer CoreBarcode PluginPDF Read & WriteTesseract OCR PluginForm Processing PluginJBIG2 CodecJPEG2000 CodecISIS ScannerTwain ScannerDICOM ReaderCAD Scanner