Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Jan 18, 2024 2:47 pm

Why is PDF files generated by Spire PDF so big. When i generate it using Adobe the pdf file size is smaller compared to Spire PDF files. Why is it like that. Any Suggestions?

NOC
 
Posts: 9
Joined: Thu Aug 03, 2017 9:04 pm

Fri Jan 19, 2024 1:57 am

Hello,

Thank you for your inquiry.
Please note that different components may have variations in document processing, including variances in internal algorithms and handling of document content. In the case of Spire.Pdf, we provide a "PdfCompressor" interface specifically designed for compressing PDF documents.
Below is an example code snippet for your reference:
Code: Select all
//Load a PDF document while initializing the PdfCompressor object
PdfCompressor compressor = new PdfCompressor("input.pdf");

//Get text compression options
TextCompressionOptions textCompression = compressor.Options.TextCompressionOptions;

//Compress fonts
textCompression.CompressFonts = true;

//Unembed fonts
textCompression.UnembedFonts = true;

//Get image compression options
ImageCompressionOptions imageCompression = compressor.Options.ImageCompressionOptions;

//Resize images
imageCompression.ResizeImages = true;

//Compress images
imageCompression.CompressImage = true;

//Set the compressed image quality
imageCompression.ImageQuality = ImageQuality.High;

//Save the compressed document to file
compressor.CompressToFile("result.pdf");

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.PDF

cron