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

Free Support Forum - aspose.com

PageSetup issue with Excel to PDF conversion


I am facing issue with PageSetup while converting my Excel template to PDF .

Following is the code line I used for this conversion :

book.Save("yahoo.pdf", SaveType.OpenInExcel, FileFormatType.Pdf, HttpContext.Current.Response);

Following is the setting for my worksheet :

book.Worksheets[0].PageSetup.PaperSize = PaperSizeType.PaperA4 ;

book.Worksheets[0].PageSetup.Orientation = PageOrientationType.Landscape;

Is there any way to set this PageSize & Orientation for converted PDF ?


Pankaj Singh

Hi Pankaj,

Could you post your template excel file which you want to convert to pdf, and also give us your output pdf file here. For obtaining excel file, you may simply save the xls file with your code (if you are not using any template file). Alternatively, you may post us your sample code to with the output pdf file here. We will check your issue soon.

Thank you.

Hi Amjad ,

PFA my excel template & output pdf . What I am trying to do here is setting default print setup for the converted PDF file.

Like I want my PDF to be printed in Size A4 & Landscape orientation.

I have given same settings to my Excel but that doesn't reflect on PDF file .

File --> PrintSetup always get default settings for PDF.

Please let me know if you need any other details on this.


Pankaj Singh

Hi Pankaj,

Well, when using different printer driver settings in Adobe Reader, the default Paper size changes accordingly from A4 - Letter, this is the behavior of Acrobat. The generated pdf file would actually be with A4 paper size and landscape orientation. But, somehow, these settings would not be reflected in the Acrobat reader. So, it is not an issue with Aspose.Cells for .NET.

Thank you.