New to Kendo UI for Angular? Start a free 30-day trial

Creating a Base64 String When Using the PDFExport

Environment

ProductProgress® 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:

  1. Use the export method of the PDFExport component. It returns a Promise that will resolve a Group object.

    <kendo-pdf-export #pdf ... >
        Content to be exported
    </kendo-pdf-export>
    @ViewChild('pdf') public pdfRef: PDFExportComponent
    
    public save(): void {
        this.pdfRef.export().then((group: Group) => {
            ...
        });
    }
  2. Pass the Group object to the built-in exportPDF 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.

    this.pdfRef.export().then((group: Group) => {
        exportPDF(group).then((dataURI) => {
            console.log(dataURI);
        });
    });

In this article

Not finding the help you need?