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
close icon

Exporting the grid to PDF

Hi,

I want to export a grid to PDF. I was looking to the sample from https://help.syncfusion.com/aspnetmvc/grid/exporting?cs-save-lang=1&cs-lang=razor but I didn't find the implementation of the method DeserializeToModel().

Thanks,
Cornel.



5 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team March 17, 2017 12:01 PM UTC

Hi Cornel,  
 
Thanks for contacting Syncfusion Support. DeserializeToModel is the method exist in the Utils class of the Syncfusion Libraries which will be available from the Syncfusion.EJ assemblies.  To use this method, you have chain its root class and namespace as follows.  
 
 
GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel); 
 
 
This has been used to deserialize the Grid Model (in string) to the GridProperties. We have also refreshed the online Help Document with this changes.  
 
 
We have also showcased the Exporting Demo in the following page which will programmatically deserialize the Grid model to GridProperties.  
 
 
We have also prepared  a sample that can be downloaded from the following location.  
 
 
Regards,  
Seeni Sakthi Kumar S. 



CA Cornel Amarandei March 17, 2017 01:28 PM UTC

Hi Seeni,

Thanks for your information.

Now it's working. But I have two more questions:

1. how can I change the orientation for the PDF to landscape?
2. I have a button that do the export like this:
   function onPDFExport(args) {
        var gridObj = $("#TurnoverGrid").ejGrid("instance");  
        gridObj.export("Turnover/ExportToPdf");        
    }
How can I transmit to the method ExportToPdf() a second parameter, beside the GridModel? I need to transmit also a date, based on what I filter the data of the grid.

Regards,
Cornel.


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team March 20, 2017 02:14 PM UTC

Hi Cornel, 


Query #1:- how can I change the orientation for the PDF to landscape? 
 
We have already discussed about how to set the orientation for the PDF document in our Syncfusion Knowledge base. For your convenience please find the KB in following link. 
 
 
 
 
Query #2 :- How can I transmit to the method ExportToPdf() a second parameter, beside the GridModel? I need to transmit also a date, based on what I filter the data of the grid 
 
 
For this query also, we have already discussed  about how to pass additional parameter to server while exporting. Please follow the below kb link. 
 
 
 
 
Regards, 
 
Farveensulthana T 



CA Cornel Amarandei March 20, 2017 02:57 PM UTC

Hi Farveensulthana,

Thanks for your information. It worked.

Regards,
Cornel.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team March 21, 2017 03:50 AM UTC

Hi Cornel,  
 
Thanks for the update.  
 
We are happy to hear that your requirement has been achieved. Please get back to us, if you require further assistance on this.  
 
Regards,  
Seeni Sakthi Kumar S. 


Loader.
Live Chat Icon For mobile
Up arrow icon