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

set margins for printing


is there a possibility to set the margins of the printing page for a grid? 

 <ej:Grid runat="server" ID="Grid" AllowPaging="true" AllowSorting="true" AllowSelection="false" Locale="de-DE">
      <ToolbarSettings ShowToolbar="true" ToolbarItems="printGrid" />
      <ClientSideEvents BeforePrint="beforePrint" />
           <ej:Column Field="id" HeaderText="Pat. Id" TextAlign="Left" Width="100" />
           <ej:Column Field="name" HeaderText="Vorname" />
           <ej:Column Field="givenname" HeaderText="Nachname" />
           <ej:Column Field="geburtsdatum" HeaderText="Geburtstag" TextAlign="Center" />
           <ej:Column HeaderText="Status" Field="state" Template="#columnTemplate" TextAlign="Center" />

Kind regards

3 Replies

PK Padmavathy Kamalanathan Syncfusion Team September 30, 2019 04:09 PM UTC

Hi Jens, 
Thanks for contacting Syncfusion Forums. 
QUERY: set margin for printing 
From your query we understand that you need to set margin to the grid while printing it. As you have tried, you can use beforePrint event and set css for the grid. 
In the beforePrint event, the argument has the page element to which you can set style. 
Please refer the below code, 
    function beforePrint(args) { 
        args.element[0].style.margin = "70px"; 
If you have further queries, please get back to us. 
Padmavathy Kamalanathan 

JL Jens Langen September 30, 2019 06:21 PM UTC

Dear Padmavathy Kamalanathan,

thank you very much. 
That is the solution.

Kind regards 

PK Padmavathy Kamalanathan Syncfusion Team October 1, 2019 02:31 PM UTC

Hi Jens, 

We are glad to hear that you have achieved your requirement. 

If you have further queries, please get back to us. 

Padmavathy Kamalanathan 

Live Chat Icon For mobile
Up arrow icon