@raghavkhunger,
Thanks for the template files, screenshots and details.
I have evaluated both your mentioned issues using your template files (“Book1.xlsx” and “Book2.xlsx”). I firstly opened both your files into MS Excel manually and found:
- Book1.xlsx file has more than 6000 pages in Sheet1
- Book2.xlsx file has more than 1800 pages in Sheet1
(Note: I take the print preview of the sheets of both workbooks in MS Excel manually)
Now seeing your line of code in your code segment you shared:
pso.OnePagePerSheet = true;
This is the culprit line. How could you render one page per those large sheets with so many pages. I am afraid, this is not possible i.e., render so much data into a single page, so you cannot render the big sheets (of so many pages) into a single page. You may confirm this even you cannot do this in MS Excel either manually. In short, please remove this line of code or comment this line.
The core thing is when Aspose.Cells tries to render (with so many records on the sheet(s)) to one page, it consumes more memory and CPU for sure, but at the end it becomes impossible to accomplish the task (render so many records into one PDF page). Sometimes, at the end, it gives out of memory error too.
For your information, OnePagePerSheet option is valid only when there are few pages like 4-10 or so. If there are more pages as in your case then OnePagePerSheet might throw out of memory exception and would be useless. Because it is impossible to render lots of pages into a single PDF page. So, first check how many pages are there in your worksheet (you may take the print preview of the sheet in MS Excel manually and get the total number of pages) and then decide if you should use OnePagePerSheet option or not.
Aspose.Cells is surely capable of rendering large MS Excel files to PDF file format speedily and efficiently. The output will be same as original file. Many of our clients are using Aspose.Cells to render their big files to image or PDF file format without any issue. The main thing is how you are rendering those big files using Aspose.Cells APIs, so you should adjust your code accordingly.
Hope, this helps a bit.