Hi Rj,
Greetings from Syncfusion support.
You can achieve the requirement of changing the margins for pdf export by overriding the Grid’s processSectionExportProperties method in its created event and use the setMargins method for setting the required margin for pdf file.
This is demonstrated in the below code snippet,
// Grid’s created event handler
function onCreated() {
var gridObj = document.getElementById('Grid').ej2_instances[0];
gridObj.pdfExportModule.processSectionExportProperties = function (section, pdfExportProperties) {
var pdfPageSettings = new ej.pdfexport.PdfPageSettings();
pdfPageSettings.orientation = ej.pdfexport.PdfPageOrientation.Portrait;
pdfPageSettings.size = gridObj.pdfExportModule.getPageSize('A4')
// Here you can set the required margin to the exported pdf file
pdfPageSettings.margins.setMargins(10);
section.setPageSettings(pdfPageSettings);
return section;
}
} |
We have prepared a sample based on this for your reference. You can find it below,
Please get back to us if you need any further assistance.
Regards,
Sujith R