{{ title }}

About PdfDocument

PdfDocument is an extension of the PDFKit, a JavaScript PDF generation library.

The key differences are:

It provides API for drawing text, vector graphics and images.

Using PdfDocument

Here is a typical sequence of steps when using PdfDocument:

  1. Create the PdfDocument class instance with the ended event handler declared. The Blob object containing document data will be passed to this event handler when document rendering is done, where it can be saved to a file.
  2. Draw the document using the instance members.
  3. Finally, call end method of the instance to finish rendering and raise the ended event.

Following is the minimal code required to generate a single page blank document:

var doc = new wijmo.pdf.PdfDocument({
    ended: function (sender, args) {
        wijmo.pdf.saveBlob(args.blob, "FlexGrid.pdf");
    }
});

doc.end();