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 formatoptions.area("viewport"|"full"|"range") - exported area; defaults to"viewport"options.dateFrom- start date (applies only toarea: "range")options.dateTo- end date (applies only toarea: "range")options.quality- quality of the output JPEG image (applies only toformat: "jpeg"); defaults to0.92options.scale- output scale factor; defaults to1(use2for 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 HTMLtoDataUri()- returns a data URI string (SVG or image data)toBlob()- returns a Blob objectdownload(filename)- forces download of the imageprint()- 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
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot