|
Rank: Newbie Groups: Member
Joined: 6/1/2015 Posts: 3
|
Please see sample code below //view <div id="grid"></div> $("#grid").kendoGrid({ columns: [ { field: "name" } ], dataSource: [ { name: "Beverages", name: "Food", }, ] } ], }); //controller public ActionResult PdfPrint(Guid id) { var model= GetModelById(id); MVCToPDF.ResultFileName = "pdf.pdf"; MVCToPDF.RenderAsPDF(); return View(model); } When I call PdfPrint action, all other page component will be printed out except this grid, which is rendered by Kendo UI. Is there way to print out this kind of Javascript rendering component in MVC? I'm using EO.Pdf version 6.0.20.2 Thanks,
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,273
|
Hi,
Please try to increase the value of HtmlToPdf.Options.MinLoadWaitTime. By default the converter will wait for a very short time after the page is loaded before it starts converting the page into PDF. However that time may not be enough for the script in your page to finish the AJAX call and populate the page with the actual data. So in that case if you increase HtmlToPdf.Options.MinLoadWaitTime it might resolve the issue for you. You should set that property immediately before you call RenderAsPDF.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 6/1/2015 Posts: 3
|
Hi,
Thanks for your help. I added HtmlToPdf.Options.MinLoadWaitTime = 30000; statement just before MVCToPDF.RenderAsPDF(); but looks like it does not work properly, I still cannot see the grid rendered by kendo ui. Anything wrong?
Thanks,
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,273
|
Hi, Please try two things: 1. Monitor the debug output to see if the page run into any JavaScript error. See here for more details (check the "Debug Console" section): http://www.essentialobjects.com/doc/4/htmltopdf/js.aspx2. Add bind method. See this post for sample code: http://www.essentialobjects.com/forum/postst8340_EOPdf--SVG-renders-blank-using-NVD3.aspxPlease let us know if those resolve the issue for you. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 6/1/2015 Posts: 3
|
Hi,
Thanks for your suggestion. However, these tips cannot solve the issue. I finally figured out that is because I have several Kendo Grid rendered on one page and some of them are rendered by client side Kendo Grid while others are rendered by server side Kendo Grid MVC. such mixed condition will cause all the grids which are rendered by client side Kendo Grid cannot display on PDF output. After changed all grids to either client side or server side, the problem is solved.
I don't know why it happened but think it is better to let you know such conditions so that you can reproduce this issue and find a better solution in your application.
Thanks,
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,273
|
Great. I am glad to hear that you found out a workaround. Thank you very much for sharing the information with us!
|
|