Free Support Forum - aspose.com

Excel to PDF Conversion Failure

I’m trying to convert an Excel document to a PDF with the oneSheetPerPage option enabled. 99% of the documents I’ve converted have worked flawlessly, but this file produced a plain white document. It looks like some information is there because you can select cell looking objects on the PDF.


Here is the code I’m using to produce the document:

Workbook wb = new Workbook(info.FullName);
foreach(Worksheet ws in wb.Worksheets){
ws.PageSetup.PrintGridlines = true;;
}
var saveOptions = new Aspose.Cells.PdfSaveOptions
{
OnePagePerSheet = true
};
wb.Save(@“C:\Users\jschmitz\Documents” + TextBox1.Text.Substring(0, TextBox1.Text.LastIndexOf(".")) + “.pdf”, saveOptions);

I’ve also attached the input and output documents. Any idea on what’s going on here?


Hi,

Thanks for your posting and using Aspose.Cells for .NET.

After initial testing, we have found this issue, my computer gets hanged when your code is used to convert the xls to pdf.

We have logged this issue in our database. Once the issue is fixed or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41386.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have looked into your issue and found that you are generating hundreds of pages in a single pdf page which generates the pdf that can not be handled correctly by PDF viewer.

If you remove

var saveOptions = new Aspose.Cells.PdfSaveOptions
{
OnePagePerSheet = true
};

Then everything works fine, so we think it is not an issue of Aspose.Cells.

Thanks for your reply. One of our goals is to convert large workbooks into single page PDFs. Is there a known upper limit to how many pages can be added to a single pdf page?

Hi,


Well, Aspose.Cells renders PDF file based on the Excel workbook that can be shown in Print Preview (The default MS Excel renderer also works the same way) in Ms Excel. Could you try to specify the PageSetup options (e.g try Fit to pages tall and wide or any other options) in Ms Excel to get a single page in print preview, I don’t think it is possible as I tried a bit. If you are succeeded to take a single page based on your long list of sheet’s data in Ms Excel manually, please save the file and send us / attach it here, we will check how to mimic the results by Aspose.Cells API.

Thank you.