PDF conversion issue

Asked by At

I am using GemBox.Spreadsheet to create and save an Excel Spreadsheet, and convert the saved sheet to PDF.

The sample program opens and writes the Excel spreadsheet as a PDF correctly, when I run it on the saved spreadsheet. In my code I save the spreadsheet, and then try to save it as a PDF. The save throws an exception Width and Height must be non-negative.

string summaryFile = outputDirectory + "Packaging\\Cover 
     ExcelFile summaryExcelWorkbook = ExcelFile.Load(summaryFile);
     ExcelWorksheet summaryExcelWorksheet = summaryExcelWorkbook.Worksheets[0];
     ExcelFile savedSummaryFile = ExcelFile.Load(summaryFile);
     savedSummaryFile.Save( outputDirectory + "Packaging\\Cover Pages\\Summary.pdf");
 catch(Exception e){

I expect the save to succeed, but the described exception is thrown.

1 Answers

Community On

This problem was caused by setting margins outside of the paper area.