exports data of a data component to a PDF file

promise toPDF(string|object|array id, [object options] );
idstring|object|arraythe exported view or its ID or an array of IDs
optionsobjectoptional, configuration options
promisea "promise" object. The promise is resolved with the contents of a PDF file that is ready for downloading.


     filename: "datatable",
     // other config options

Related samples


If the first parameter is the array of IDs, several views are exported.


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" });

Changing Font for Exported File

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:


Related sample:  Export to PDF: Changing Font

Note that only .ttf font files are supported.

Customizing Export a Datatable to PDF

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

  1. export several components into one PDF document
  2. providing a custom filename
  3. disabling file download in a browser
  4. defining the PDF page orientation
  5. stripping HTML tags from the cells
  6. setting custom columns for export
  7. defining custom header, width or template for data in the specified column
  8. rendering a template set in the widget dataset
  9. including extra fields into export
  10. defining the columns' width automatically
  11. displaying some text or image in the header of the export file
  12. ignoring particular columns
  13. outputting certain data from a data set
  14. modifying data of exported items
  15. omitting the header or footer of Datatable during export
See also
Back to top