.xlsx to .pdf has excess pages

Hello,


Our team uses the cells API to convert .xlsx documents into PDFs via the PutConvertWorkBook method. We received an xlsx file from a client that converted to an 1824 page pdf, even though it really should have been 2-4 pages. I tried to search the forums to see if this has happened to anyone else, but couldn’t find anything.

If I first save the .xlsx in, for instance, LibreOffice, and then try to process it, it converts correctly to 2 pages.

Is anyone familiar with this issue? These are the options we are using:


String xml = “” +
“pdf” +
“SampleWordDocumentOutput.pdf” +
“Jpeg” +
“100” +
“Flate” +
“” +
“true” +
“300” +
“0” +
“” +
“”;


Thank you!



Hi there,


Thank you for contacting Aspose support. I am afraid, we have to ask you to share the problematic sample here so we could review it and then share our findings.

Hi Babar,


Is there a way I can send the sample file to you/Aspose privately for review?
It contains client information that I am unable to post on a public forum.



Hi again,


Please use the contact button on the post window to send me an email, with it, you can attach your sample spreadsheet. Once you have sent the sample via the aforementioned method, please post a response here so we could check the sample from email and acknowledge you here.

Thank you, I have sent an email with the attachment.


Hi there,


Thank you for sharing the sample. I am currently evaluating the scenario on my side and I will shortly get back with updates in this regard.

Hi again,


This is to update you that I have checked your sample spreadsheet as well as the conversion process while using Aspose.Cells for Cloud and Excel application. Please note, if you convert the spreadsheet with Excel application, it generates 1824 PDF pages. You can manually check the conversion on your side or inspect the number of printed pages in Excel’s Print Preview. You will notice that there are 4 pages in worksheet “Sheet1” & 1820 pages in worksheet “Support”. I have also attached the snapshots here after redacting some contents. As the Aspose.Cells APIs are generating the same number of PDF pages as of Excel application therefore the said scenario is not a bug on the part of Aspose.Cells APIs. Please also note that Aspose.Cells APIs follow Excel guidelines and specifications in its processes therefore it is best that you should always compare the results of Aspose.Cells APIs with Excel application only.

That said, please note that the worksheet “Support” has first row painted up-till the column XED therefore when you convert the spreadsheet to PDF (using Excel or Aspose.Cells APIs), all the columns are considered to be the part of Print Area, hence the number of PDF pages increases. If you wish to reduce the number of printed pages to actual data in the worksheet, you need to set the Print Area manually in Excel and then convert the spreadsheet to PDF. You can also use the PageSetup resource of Aspose.Cells for Cloud APIs to dynamically set the print area to desired cell range.

Ah, I see. Thank you for the analysis and quick response.