0

Im trying to find a way to convert xls files to pdf, and gembox spreadsheet is great for this. But i need to be able to make it fit to one page as you can when printing to pdf via excel.

Jonas Olesen
  • 568
  • 5
  • 25

1 Answers1

2

Try specifying FitWorksheetWidthToPages and FitWorksheetHeightToPages properties.
For example like the following:

ExcelFile workbook = ExcelFile.Load("Sample.xls");
ExcelWorksheet worksheet = workbook.Worksheets.ActiveWorksheet;

worksheet.PrintOptions.FitWorksheetWidthToPages = 1;
worksheet.PrintOptions.FitWorksheetHeightToPages = 1;

workbook.Save("Sample.pdf");

I hope this helps.

Mario Z
  • 4,328
  • 2
  • 24
  • 38