Xlsx conversion to PDF generates 200MB file

Using the latest version of Aspose.Cells, a 120k test file generates a 200 MB PDF file, and takes about 6 minutes.

        using (Workbook workbook = new Workbook(m_InputFile))
        {
            PdfSaveOptions pdfOpts = new PdfSaveOptions();
            workbook.Save(m_OutputFile, pdfOpts);
        }

@dbartle,

Please zip your 120k test file and attach it here. We will check your issue soon.

Test Results.zip (117.6 KB)

@dbartle,

Thanks for the template file.

I checked your file and found the second sheet has 89k pages and most of the pages have unnecessary formatting without any data. So, rendering such huge list of pages in PDF would surely take time and create such a big file in size. To confirm if the second worksheet has many pages, you may open the file into MS Excel manually and take the print preview of the second sheet and you will notice this. To cope with it, you may add the following code segment to your code before rendering to PDF. I have tested using the following sample code and it works, the time cost is in seconds and the output file size is 1.2MB which is ok:
e.g
Sample code:

..........
//Set the printable areas for the sheets based on data area only.
             foreach (Worksheet sheet in workbook.Worksheets)
             {
                
                 sheet.Cells.DeleteBlankRows();
                 sheet.Cells.DeleteBlankColumns();

                 int maxCol = sheet.Cells.MaxDataColumn;
                 int maxRow = sheet.Cells.MaxDataRow;

                 if (maxCol > 0 && maxRow > 0)
                 {
                     Aspose.Cells.PageSetup pageSetup = sheet.PageSetup;
                     pageSetup.PrintArea = "A1:" + CellsHelper.CellIndexToName(maxRow, maxCol);

                 }
             }
.......

Let us know if you still find any issue.

Awesome thank you

@dbartle,

You are welcome.