toPNG

exports data of a component to a PNG file

object toPNG(string|object id, [string|object options] );

Parameters

idstring|objectthe exported view or its id, or the id of any HTML element
optionsstring|objectoptional, a set of configuration options or the name of the output PNG file

Returns

objecta "promise" object. The promise is resolved with the contents of a PNG file that is ready for downloading.

Example

webix.toPNG($$("myChart"),{/* config options */});

Related samples

Details

options for the method can include the following:

  • setting the output filename (the default name is Data.png):
webix.toPNG($$("table"), "somefile");
// or
webix.toPNG($$("table"), {
    filename:"somefile"
});
  • disabling the download of a file via the download property:
webix.toPNG($$("table"), {
   download:false
}).then(function(blob){
   //process raw data
});
  • ignoring some DataTable columns in the output file:
webix.toCSV($$("table"), {
    ignore: { "votes":true, "rating":true }
});
See also
Back to top