Free Support Forum - aspose.com

PDF file size

Hi Team ,


I’ve evaluated the scenario of converting ExcelToPDF still seeing an increase in the pdf file size. I tried with the options below :

PdfSaveOptions pdfOpts = new PdfSaveOptions();
pdfOpts.OptimizationType = PdfOptimizationType.MinimumSize;

What could be the cause here ? Is there any specific way to implement the functionality.

Thanks in advance.

Hi Sumanth BS,


What is your input Excel file size and output PDF file size? Also when you render Excel file to PDF via Ms Excel renderer, what is the size of the output PDF file? Is there any significant difference you noticed comparing the size of output PDF (via Aspose.Cells APIs) Vs PDF file via MS Excel. Please provide your template Excel file and output PDF file via Aspose.Cells for .NET v16.11.0. Also, paste your complete sample code (runnable) here, we will check it soon.

Thank you.

Hi Team ,


1.Excel input file size is : 10 KB , generated output pdf file size is : 39 KB ,
2.When we render via Ms Excel renderer size is : 3.9 KB
3. Aspose conversion rate is very less (for e.g if the input file size is 390Kb output PDF size will be around 1.5 MB) though I’ve incorporated Aspose.Cells.Rendering
Sample Code :

// Get the template excel file path.
string designerFile = @“C:~\Files” + “Test.xlsx”;
// Specify the pdf file path.
string pdfFile = @"~\Files" + “Output.out.pdf”;
// Create a new Workbook.
// Open the template excel file which you have to
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(designerFile);
PdfSaveOptions pdfOpts = new PdfSaveOptions();
pdfOpts.OptimizationType = PdfOptimizationType.MinimumSize;
// Save the pdf file.
wb.Save(pdfFile, pdfOpts);

what could be the cause? and how can we resolve the issue.

Thanks in advance.

Hi Sumanth,


First of all, please note that Aspose.Cells APIs use a custom PDF rendering engine which tries to match the results (in fidelity as well as file size) with Excel’s generated PDF files. However, in some cases Aspose.Cells APIs are not able to achieve the same results what Excel application can. As far as size of the PDF document is concerned, the PdfOptimizationType.MinimumSize tries to generate the PDF in minimum possible size. If you are not satisfied with it, we humbly request you to try the case against the latest version of Aspose.Cells for .NET 16.11.1 (attached). If you still have concerns then please share the input spreadsheet, PDF generated with Excel (while enabling the Minimum Size option as shown in attached snapshot) and the resultant PDF generated with Aspose.Cells for .NET 16.11.1. Upon further reviewing the aforementioned samples, we will be in a better position to comment if the PDF file size can be further improved with Aspose.Cells APIs or not.

Thank you for your understanding and cooperation.

Hi Team ,


I’ve attached the sample application which has the latest version of aspose.cells and it also has the sample files(inside Files folder of the project). Please let us know what can be done to achieve the desired functionality .

Thanks in advance.


Hi Sumanth,


Thank you for the sample application. Please also share the test.xlsx referenced in your code as well as the PDF generated with Excel application as requested in my previous response. Please note, the resultant PDF file size depends on amount of data, objects and so on therefore we need to perform test on your sample.