Failed to load PDF document.

by using "Syncfusion.Mvc.Pdf"   
---Assembly Syncfusion.Pdf.Helper.Mvc, Version=14.2500.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89---
ExportAsActionResult function to export PDF , it failed to load the document 

toolbarClick: toolbarclick,
        toolbarSettings: {
            showToolbar: true,
            toolbarItems: [
                ej.TreeGrid.ToolbarItems.PdfExport,
            ]
        },

function toolbarclick(args) {
    this.exportGrid = this["export"];
    if (args.itemName == "PDF Export") {
        args.cancel = true;
            window.location.rel='nofollow' href ="" ;
        
    }
}

7 Replies

PE Punniyamoorthi Elangovan Syncfusion Team July 24, 2018 02:29 PM UTC

Hi Weam, 
Thank you for contacting Syncfusion support 
We have analyzed the reported issue, but we are unable to reproduce the reported issue in our end. In TreeGrid we need to add the following dependent assembly files for exporting the TreeGrid control.  
Syncfusion.EJ.Export 
Syncfusion.Linq.Base 
Syncfusion.Pdf.Base 
Syncfusion.XlsIO.Base 
Syncfusion.compression.base 
Syncfusion.DocIO.Base 
We have also prepared the sample for your reference, please find the sample link below 
Please let us know if you require further assistance on this. 
Regards, 
Punniyamoorthi 




WG weam ghalab July 25, 2018 07:11 AM UTC

ExportAsActionResult function to export PDF  in MVC , it failed to load the document  


PE Punniyamoorthi Elangovan Syncfusion Team July 26, 2018 01:52 PM UTC

Hi Weam, 
We have analyzed your reported issue, but we are unable to reproduce the issue in our end. The PDF exporting is working fine in our attached sample without any issues. Please refer the below screenshot 
 
 
Is the PDF file not generated in your application or the data is not loaded in the exported PDF properly, Can you please share more details related to the PDF export issue you are facing. 
If you can please share your sample with replication steps, it will be very helpful for us to understand your requirement clearly. 
 
We have prepared the sample for your reference, please find the sample link below 
 
Regards, 
Punniyamoorthi 




WG weam ghalab July 29, 2018 12:50 PM UTC

using Syncfusion.Pdf;
using Syncfusion.Mvc.Pdf;
using Syncfusion.Pdf.Tables;
using Syncfusion.Pdf.Graphics;
        public ActionResult ExportPDF()
        {
DataTable dataTable = GetDataTable();
            PdfDocument doc = new PdfDocument();
PdfPage page = doc.Pages.Add();
PdfLightTable table = new PdfLightTable();
            table.DataSource = dataTable;
            table.Draw(page, new PointF(20, 15));
            return doc.ExportAsActionResult('x.pdf', HttpContext.ApplicationInstance.Response, HttpReadType.Save);
        }


the exported file not use the grid data but new data display in specific page structure
the saved file is Corrupted and opened with this msg  "Failed to load PDF document."


PE Punniyamoorthi Elangovan Syncfusion Team July 30, 2018 01:14 PM UTC

Hi Weam, 
We have analyzed your code snippet and we need some clarification on this. Can you please let us know whether you need to export the TreeGrid control or Grid control and also from your provided code snippet you referred the (using Syncfusion.Pdf;using Syncfusion.Mvc.Pdf;using Syncfusion.Pdf.Tables;using Syncfusion.Pdf.Graphics) assembly references in your application and these are unwanted assembly reference for exporting the TreeGrid control and we suggest you to refer the below references for Exporting the TreeGrid control 
using Syncfusion.EJ.Export; 
using Syncfusion.XlsIO; 
 
In ExportPDF method you called the table.Draw() method and these codes are the unwanted for TreeGrid exporting. Please refer the proper methods to exporting the TreeGrid control from below code snippet 
public void ExportToPdf(string TreeGridModel) 
        { 
            PdfExport exp = new PdfExport(); 
            var DataSource = this.GetDefaultData(); 
            TreeGridProperties obj = ConvertTreeGridObject(TreeGridModel); 
            exp.Export(obj, DataSource, new TreeGridExportSettings() { Theme = ExportTheme.FlatSaffron }, "Export"); 
        } 
 
We suggest you to make the changes in your application with code snippet we have provided and if still the issue is replicating in your sample please share your application with us, It will be helpful for us to provide the better solution. 
We have prepared the sample for your reference, please find the sample link below 
Please let us know if you require further assistance on this.  
Regards,  
Punniyamoorthi  
 



WG weam ghalab July 31, 2018 07:15 AM UTC

thanks for your support and help



JR John Rajaram Syncfusion Team August 1, 2018 02:03 PM UTC

Hi Weam, 
Thank you for your update. 
Let us know if you need further assistance on this. 
Regards, 
John R 


Loader.
Up arrow icon