With the help of the open-source jsPDF library, the Scheduler can be exported to a PDF document on the client side.

Printing through PDF Export

The PDF export is especially useful when printing the Scheduler. The Scheduler supports direct printing of the exported image (JPEG, PNG, SVG) using the built-in print dialog but that has limitations. Printing the PDF gives you more control over the output:

  • add custom headers, footers and additional content
  • control the paper size and orientation
  • split the output to multiple pages (by resources or time)

Unfortunately, there is no way to invoke the print dialog automatically during PDF export.

How to Export the Scheduler to PDF

In order to export the Scheduler to PDF, you need to create a new PDF document using jsPDF and insert the Scheduler, exported as JPEG image.

In order to improve the image quality (especially for printing), it's a good idea to use an image scale higher than 1:1 pixels. The following example uses scale:2 (200% magnification).

var dp = new DayPilot.Scheduler("dp");
// ...

function createPdfAsBlob() {

  var doc = new jsPDF("landscape", "mm", "a4");
  doc.text(35, 25, "Scheduler");

  var image = dp.exportAs("jpeg", {
        area: "viewport",
        scale: 2,
        quality: 0.95
  var dimensions = image.dimensions();
  var ratio = dimensions.width / dimensions.height;
  var width = 280;
  var height = width/ratio;
  doc.addImage(image.toDataUri(), 'JPEG', 10, 40, width, height);

  return doc.output("blob");