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

Free Support Forum - aspose.com

Page setup issue


I am having problem in page set up when i save excel as pdf.

I want the page orientation should be “Landscape” and page size as A3, I am setting up these for individual worksheets as in below code. but when i see the print preview for generated PDF, it shows “Letter” as page size and orientation as “portrait”.
string excelFile =“D:\Temp\test.xls”;
string pdfFile = “D:\Temp\test.pdf”;
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(excelFile);
//Save the pdf file.

wb.Worksheets[“Pricing Analysis”].PageSetup.Orientation = PageOrientationType.Landscape;
wb.Worksheets[“Pricing Analysis”].PageSetup.PaperSize = PaperSizeType.PaperA3;
wb.Worksheets[“Product Analysis”].PageSetup.Orientation =
wb.Worksheets[“Product Analysis”].PageSetup.PaperSize = PaperSizeType.PaperA3;

wb.Save(pdfFile, SaveFormat.Pdf);

Please help in resolving this issue


Hi Parvati,

Thanks for your posting and using Aspose.Cells.

PageSetup option of Aspose.Cells controls the PageSetup of MS-Excel. When it is converted to PDF, it does not control the Print (Page Setup) option of Adobe Reader.

You can also manually save your spreadsheet into pdf using MS-Excel and then check the pdf in the Adobe Reader, you will see Adobe Reader Print (Page Setup) settings do not get changed.

Hi Shakeel,

Thanks a lot for the reply.