We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Spreadsheet pdf orientation


I'm trying to have the exported pdf from the javascript spreadsheet library in the landscape orientation.

My beforeSave function looks like this:

beforeSave: function (args) {

    if (args.saveType == 'Pdf') {

         args.pdfLayoutSettings.fitSheetOnOnePage = true;

         // possible solution something like this?

         // args.pdfPageSettings.orientation = PdfPageOrientation.Landscape;



3 Replies

SP Sangeetha Priya Murugan Syncfusion Team November 18, 2022 09:13 AM

Hi Marcel,

Your requirement can be achieved by setting the orientation property as shown below in the server side save action.

Code Example:




        public IActionResult Save([FromForm] SaveSettings saveSettings)



            if (saveSettings.SaveType.ToString() == "Pdf")


                saveSettings.SaveType = SaveType.Xlsx;

                ExcelEngine excelEngine = new ExcelEngine();

                IApplication application = excelEngine.Excel;

                Stream fileStream = Workbook.Save<Stream>(saveSettings);


                IWorkbook workbook = application.Workbooks.Open(fileStream);


                saveSettings.SaveType = SaveType.Pdf;


                //Initialize XlsIORendererSettings

                XlsIORendererSettings settings = new XlsIORendererSettings();


                //Set layout option as FitAllColumnsOnOnePage

                settings.LayoutOptions = LayoutOptions.FitAllColumnsOnOnePage;


                //Initialize XlsIORenderer

                XlsIORenderer renderer = new XlsIORenderer();


                int i, sheetCnt = workbook.Worksheets.Count;

                for (i = 0; i < sheetCnt; i++)


                    workbook.Worksheets[i].PageSetup.PrintGridlines = true;

                    settings.DisplayGridLines = GridLinesDisplayStyle.Auto;


                //Convert the Excel document to PDF with renderer settings

                PdfDocument document = renderer.ConvertToPDF(workbook, settings);



                //Adds page settings

                document.PageSettings.Orientation = PdfPageOrientation.Landscape;

                document.PageSettings.Margins.All = 50;


                //Saving the Excel to the MemoryStream

                MemoryStream stream = new MemoryStream();



                //Set the position as '0'

                stream.Position = 0;


                //Download the PDF file in the browser

                FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/pdf");

                fileStreamResult.FileDownloadName = "Output.pdf";

                return fileStreamResult;




                return Workbook.Save(saveSettings);



Please find the sample link below.

Sample Link: https://stackblitz.com/edit/react-woka1m-minvcw?file=index.js

Service Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebAPI-PDF644225911

Note: Launch the service first and then open the stackblitz sample for import and export.

Could you please check the above details and get back to us if you need any further assistance on this.


Sangeetha M

M M replied to Sangeetha Priya Murugan November 18, 2022 10:15 AM

Hi Sangeetha M,

Thank you for your quick response!

I'm using the endpoint syncfusion is providing (https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save).

Is it possible to add parameters to the request so it will be rendered in landscape?

Best regards,


SP Sangeetha Priya Murugan Syncfusion Team November 21, 2022 09:00 AM

Currently, we don’t have support to include an orientation setting for PDF export in a spreadsheet. But we have considered this as an improvement, and it will be available in any of our upcoming releases. Appreciate your patience until then. You can track the status of this improvement using the link below from our feedback portal. 

Feedback Portal Link: https://www.syncfusion.com/feedback/39241/provide-support-to-add-the-orientation-settings-for-pdf-export

Live Chat Icon For mobile
Up arrow icon