The exportAs() method exports the Gantt Chart in the specified image format or as an Excel spreadsheet.
DayPilot.Gantt.exportAs(format[, options]);format ("svg" | "png" | "jpeg" | "xksx") - 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.resourceFrom - start task (vertically, applies only to area: "range")
options.resourceTo - end task (vertically, 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% size)
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
const image = gantt.exportAs("png", {
area: "viewport",
scale: 2
});
image.download("gantt.png");Client-Side Image Export [doc.daypilot.org]