exportPDF

Exports a group of drawing elements as a PDF file (see example). In the exported file, the group is positioned at [0, 0]. Its dimensions are used as the default dimensions for the image.

Scene images have to be of same origin or CORS-enabled.

The export operation is asynchronous and returns a promise.

import { Path, Text, Group, pdf } from '@progress/kendo-drawing';
import { saveAs } from '@progress/kendo-file-saver';

const { exportPDF, PDFOptions } = pdf;

export function exportScene() {
  // Create a path and draw a straight line
    const path = new Path({
        stroke: {
            color: `#9999b6`,
            width: 2
        }
    });

    path.moveTo(0, 50).lineTo(200, 50).close();

  // Create the text
    const text = new Text(`Hello World!`, [ 20, 25 ], {
        font: `bold 15px Arial`
    });

  // Place all the shapes in a group
    const group = new Group();
    group.append(path, text);

    const options = { paperSize: "A5", landscape: true };
    exportPDF(group, options).then((data) => {
        saveAs(data, "scene.pdf");
    });
}

Parameters

group Group

The Group to export.

options? PDFOptions

The PDF Export options.

Returns

Promise<string> - A promise that will be resolved with a PDF file encoded as a Data URI.

 /