Hi Thomaz,
Thanks for using Syncfusion products.
Query: “How can I change a layout to export to pdf?”
We have analyzed your query and the layout of the pdf export can be changed by changing the pdf - exportProperties pageOrientation to “Landscape”. Also In the pdf export, columns splits into multiple pages when number of columns is more than the view port size. The default behavior of the pdf export is to export grid columns according to the width of the page. So we suggest you to use “landscape” pageOrientation to achieve your requirement. We have given a sample and a documentation link for your reference.
Code Example:
[index.cshtml]
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).ToolbarClick("toolbarClick").Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").Width("130").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
...
}).AllowPaging().AllowPdfExport(true).PageSettings(page => page.PageCount(2)).Toolbar(new List<string>() { "PdfExport" }).Render()
...
<script>
function toolbarClick(args) {
var gridObj = document.getElementById("Grid").ej2_instances[0];
if (args.item.id === 'Grid_pdfexport') {
var exportProperties = {
pageOrientation: 'Landscape',
};
gridObj.pdfExport(exportProperties);
}
}
</script> |
Please get back to us for further assistance.
Regards,
Logesh R