We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with Aspose SheetRender API Meta Data page count

Hi Aspose Team,

We are experiencing an issue with out micropdf service. The PDF service returns a multipart response - it includes the PDF as one part, and some metadata about the PDF in another part. The metadata contains information about the PDF, including the number of pages within it.

For some reason, our file.xlsx, the PDF microservice generates a PDF with 9 pages (if you view it in a PDF viewer) but the meta data says it has 10 pages. When our product reads this metadata, ultimately it results in the IndexOutOfBoundsException in the server logs, because it attempts to read a 10th page that is not actually in the PDF.

The microservice uses the Aspose SheetRender API to count the pages in the spreadsheet (see ExcelToPdfBase.java line 72), rather than counting the number of pages in the actual PDF. This is the same algorithm as E-WorkBook as far as I can tell. For some reason, using the Aspose SheetRender API gives a different number of pages than in the actual PDF generated by Aspose

If we open the file in Excel, make no changes and immediately Save As… to create a copy, then the copy opens just fine in the product.

We would appreciate if you could investigate into this issue as to possible causes.



By default, Aspose.Cells’ SheetRender API gives you the number of pages of a worksheet, which should be same (display same number of pages) when you take the print preview of the sheet in MS Excel manually. If you find any difference, then could you please separate the issue of Aspose.Cells APIs and share your input Excel file and sample code (runnable) to reproduce the issue on our end, we will check it soon.

P.S. Please zip the Excel file prior attaching here.

@Amjad_Sahi Apologies on the delay. I have raised this internally I need approval to post sample product code. I will update as soon as I have it.


Please take your time to create and gather the resource files (sample file and code, etc.) to post us. Once we receive your samples, we will start investigating the issue on our end.