exports data of a data component to a PDF file
id | string|object|array | the exported view or its ID or an array of IDs |
options | object | optional, configuration options |
promise | a "promise" object. The promise is resolved with the contents of a PDF file that is ready for downloading. |
webix.toPDF($$("table"),{
filename: "datatable",
// other config options
});
If the first parameter is the array of IDs, several views are exported.
webix.toPDF(["datatable","chart"]);
Configuration options can contain several useful settings. For example, canvas-based components like Chart can be exported as images, if you pass display:"image" parameter:
webix.toPDF("chart", { display:"image" });
By default, Webix provides the pt-sans.regular.ttf font file for export. If it doesn't suit you, e.g. you need specific characters that are not included in the font, you can add another file to the "extras" folder and define the fontName option:
webix.toPDF($$("mylist"), { fontName:"custom" });
Or you can specify the URL of the font you need in the fontURL parameter:
webix.toPDF("$dt",{
fontName:"name",
fontURL:"url",
})
Related sample: Export to PDF: Changing Font
Note that only .ttf font files are supported.
The method returns all data specified in the columns parameter of a datatable view. The data are exported into a PDF document with the "data" name.
However, you may need to get some particular data or customize file properties.
Export API allows