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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

set margins for printing

Thread ID:

Created:

Updated:

Platform:

Replies:

147964 Sep 27,2019 12:56 PM UTC Oct 1,2019 02:31 PM UTC jQuery 3
loading
Tags: ejGrid
Jens Langen
Asked On September 27, 2019 12:56 PM UTC

Hello,

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" />
      <Columns>
           <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" />
      </Columns>
 </ej:Grid>

Kind regards
Jens 

Padmavathy Kamalanathan [Syncfusion]
Replied On 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, 
 
<script> 
 
    function beforePrint(args) { 
        args.element[0].style.margin = "70px"; 
    } 
</script> 
 
 
If you have further queries, please get back to us. 
 
Regards, 
Padmavathy Kamalanathan 


Jens Langen
Replied On September 30, 2019 06:21 PM UTC

Dear Padmavathy Kamalanathan,

thank you very much. 
That is the solution.

Kind regards 
Jens

Padmavathy Kamalanathan [Syncfusion]
Replied On 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. 

Regards, 
Padmavathy Kamalanathan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon