print
prints a view according to the specified settings
void print(object| id view, [object options] );
view | object| id | the object or id of the view to print |
options | object | a set of printing options, see the list below |
Example
//view obj or view id
webix.print($$("datatable1"));
webix.print("datatable1");
//with options
webix.print($$("datatable1"), {mode:"landscape"});
Related samples
Details
Common printing options
(for all widgets)
- paper - (string) paper size. Possible values are stored in the webix.env.printSizes array. The default value is "a4". If there is no object in the printSizes array with the id: "a4", the first one in the array will be used.
- mode - (string) page orientation. Possible values are "portrait" (default), "landscape"
- margin - (number|object) margin for printed pages, can be of two types:
- number - to set the same margin from all sides
- object - with any of the properties: top, right, bottom, left containing number to set margins separately
- docHeader - (string) document header on the first page before the printed view (independent of the browser print header)
- docFooter - (string) document footer on the last page after the printed view (independent of the browser print header)
There are also additional properties that vary depending on the component.
For data components
- scroll - (boolean) if true, prints only a visible part of a scrolled component. False by default.
For datatable, dataview, spreadsheet, X-list
- fit - (string) adjusts printed component either to the page width ("page", default), or to the component width ("data").
For datatable and spreadsheet
- header - (boolean) renders header for datatable, if exists
- true (default for datatable)
- false (default for spreadsheet)
- skiprows - (boolean) skips empty rows within the datatable. False by default
- borderless - (boolean) removes borders for datatable cells. False by default
- trim - (boolean) removes empty rows and columns on the edges of datatable.
- true (default for spreadsheet),
- false (default for datatable)
- data (string) - defines which data to print:
- "selection" - selected data from the current sheet
For datatable only
- footer - (boolean) renders footer for datatable, if exists. True by default
For spreadsheet only
- sheets (boolean, array, string) - defines which sheets to print. The possible values are:
- boolean - set to true to print all the sheets
- array - set an array with sheet IDs to print them
- string - set sheet ID to print it
- sheetnames - (boolean) renders name of sheets for each table. True by default.
- external - (boolean) - if true, prints data from the additional views of the sheet
See also
Back to top