I am making an application where it will be necessary to create a PDF with more than 2 pages.
From the documentation I saw that it is necessary to generate the HTML in a DIV and generate the PDF.
This is working fine when it's just a page.
But for multiple pages this is giving problem.
What I need is a way to "hide" the "GeneratedPDF" Div for the user and only generate the PDF (when hidden the content is not generated in the PDF).
And how do I page break between the two sample URLs?
My code:
<div id="GeneratedPDF"></div><input type="button" class="button blue" id="btnCreatePDF" value="Create PDF" />
<script> $("#btnCreatePDF").click(function () { var html = ""; $.ajax({ url: "/PageForTheExample1", type: "GET", dataType: "html", success: function (data) { html += data; $.ajax({ url: "/PageForTheExample2", type: "GET", dataType: "html", success: function (data) { html += data; CreatePDF(html); } } }); }); function CreatePDF(html) { $('#GeneratedPDF').html(html); kendo.drawing.drawDOM($('#GeneratedPDF')).then(function (group) { kendo.drawing.pdf.saveAs(group, "Export.pdf"); }); }</script>
xxx