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

sfDataGrid to pdf

Is there any method where I can directly pass the sfDatagrid to generate a pdf file.?

1 Reply

JS Jayapradha S Syncfusion Team June 5, 2014 11:33 AM UTC

Hi Faysal,

 

Thank you for contacting Syncfusion Support.

 

Yes , it is possible to generate grid to pdf file by using ExportToPdf() method as shown in the following code snippet:

 

Code Snippet:

 

  PdfDocument document = new PdfDocument();

  document = datagrid.ExportToPdf();

  var savePicker = new FileSavePicker { SuggestedFileName = "file1", SuggestedStartLocation = PickerLocationId.Desktop };

 savePicker.FileTypeChoices.Add("Pdf Files(.pdf)", new List<string>() { ".pdf" });

  var storageFile =await savePicker.PickSaveFileAsync();

  if (storageFile != null)

 await document.SaveAsync(storageFile);

 

Please let us know if this solution helps you.

 

Regards,

Jayapradha S


Loader.
Up arrow icon