DHTMLX grid to PDF in .Net

Hello,

We use DHTMLX grid in our project and need to export the contents from DHTMLX grid to Excel & PDF. We are able to export to excel successfully. But we are not able to export to PDF and getting “Adobe Reader could not open ‘grid[1].pdf’ because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn’t correctly decoded).” message before opening the PDF document.

We use the similar code of Excel export to export PDF.

  1. Included “dhtmlxgrid_export.js” file
  2. Referenced DHTMLX.Export.PDF DLL
  3. Added a handler page with the below code on it.
    var writer = new PDFWriter();
    var xml = context.Request.Form[“grid_xml”];
    xml = context.Server.UrlDecode(xml);
    writer.Generate(xml, context.Response);
  4. documentsUnderFolderGrid.toPDF(‘…/Export/ExportPDF.ashx’, ‘color’);

Please let me know if i need to include any or I missed.

Thanks.