DayPilot.Month.exportAs

The exportAs() method exports the monthly calendar in the specified image format.

Declaration

DayPilot.Month.exportAs(format[, options]);

Parameters

  • format ("svg" | "png" | "jpeg" | "xlsx") - output image format

  • options.area ("viewport" | "full" | "range") - exported area; defaults to "viewport"

  • options.dateFrom - start date (applies only to area: "range")

  • options.dateTo - end date (applies only to area: "range")

  • options.quality - quality of the output JPEG image (applies only to format: "jpeg"); defaults to 0.92

  • options.scale - output scale factor; defaults to 1 (use 2 for 200% magnification)

Return Value

Returns a DayPilot.Export object that provides the following methods:

  • toElement() - returns a DOM element with the image (<svg> or <img>)

  • toHtml() - returns the image element as HTML

  • toDataUri() - returns a data URI string (SVG or image data)

  • toBlob() - returns a Blob object

  • download(filename) - forces download of the image

  • print() - prints the exported image using the browser print dialog

Notes

Use options.area to export the current viewport, the full calendar, or a custom date range. When area is set to "range", you need to specify options.dateFrom and options.dateTo.

The quality option only affects JPEG output, and scale controls the size of the generated image.

Example

const image = dp.exportAs("png", {
  area: "full",
  scale: 2
});

image.download("month.png");

See Also

DayPilot.Month Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript