Generating PDF Output Overview
The Drawing library provides low-level drawing capabilities and can export any scene to a PDF file using the exportPDF function. Use this function when you need a print-ready, portable document—an invoice, a report, a ticket, or a snapshot of a DOM-drawn layout—generated entirely on the client, without a server-side rendering step.
The following demos illustrate how to export content to PDF using the Drawing library.
Exporting to PDF
To export a scene to a PDF file, use the exportPDF function provided by the Drawing library. It takes the root Group of a scene and an optional PDFOptions object, and returns a promise that resolves with the document as a Base64-encoded Data URI that you can save to disk, open in a new tab, or upload.
The PDFOptionsobject controls the paper size, margins, orientation, multi-page behavior, embedded fonts, and document metadata. For more details refer to the Configuration Options documentation.
import { exportPDF } from "@progress/kendo-drawing";
exportPDF(group, options)
.then(dataUri => {
// Save, upload, or preview the generated PDF.
});
A scene can come from two sources: build it directly from basic shapes, or capture existing page content with drawDOM, as described in Drawing DOM Elements.