saveAsPDF
Initiates the PDF export. Also fires the pdfExport event.
Calling this method may trigger the built-in popup blocker of the browser. To avoid that, always call it as a response to an end-user action, for example, a button click.
Parameters
options Object
An options
object with the same structure as the pdf options.
Returns
Promise
- A promise that will be resolved when the export completes. The same promise is available in the pdfExport event arguments.
Example - manually initiating the export to PDF
<button id="export">Export to PDF</button>
<div id="spreadsheet"></div>
<script>
$("#spreadsheet").kendoSpreadsheet({
sheets: [{
rows: [{
cells: [{ value: "A" }, { value: "B" }, { value: "C" }]
}, {
cells: [{ value: "1" }, { value: "2" }, { value: "3" }]
}, {
cells: [{ value: "4" }, { value: "5" }, { value: "6" }]
}]
}],
pdf: {
fileName: "Test.pdf"
}
});
$("#export").click(function(e) {
var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
spreadsheet.saveAsPDF({ area: "selection" });
});
</script>
<!-- Load Pako library to enable PDF compression -->
<script src="https://unpkg.com/pako/dist/pako_deflate.min.js"></script>