New to Kendo UI for Angular? Start a free 30-day trial
Creating a Base64 String When Using the PDFExport
Environment
Product | Progress® Kendo UI® PDFExport for Angular |
Description
How can I create a Base64 string when exporting content to PDF file using PDFExport component?
Solution
To get a Base64 string and upload it to the server along with other form data:
-
Use the
export
method of the PDFExport component. It returns a Promise that will resolve aGroup
object.html<kendo-pdf-export #pdf ... > Content to be exported </kendo-pdf-export>
ts@ViewChild('pdf') public pdfRef: PDFExportComponent public save(): void { this.pdfRef.export().then((group: Group) => { ... }); }
-
Pass the
Group
object to the built-inexportPDF
method of the Drawing package. The method returns a Promise that is resolved with a PDF file encoded as a Data URI and which is suitable for any further processing.tsthis.pdfRef.export().then((group: Group) => { exportPDF(group).then((dataURI) => { console.log(dataURI); }); });