demos/Collage/fabric.js
function (format, quality) {
      var canvasEl = this.upperCanvasEl || this.lowerCanvasEl;

      this.renderAll(true);
      var data = (fabric.StaticCanvas.supports('toDataURLWithQuality'))
                   ? canvasEl.toDataURL('image/' + format, quality)
                   : canvasEl.toDataURL('image/' + format);
      this.renderAll();
      return data;
    }
function (format, quality) {
      var canvasEl = this.upperCanvasEl || this.lowerCanvasEl;

      this.renderAll(true);
      var data = (fabric.StaticCanvas.supports('toDataURLWithQuality'))
                   ? canvasEl.toDataURL('image/' + format, quality)
                   : canvasEl.toDataURL('image/' + format);
      this.renderAll();
      return data;
    }
function ( format , quality ) { var canvasEl = this . upperCanvasEl || this . lowerCanvasEl ; this . renderAll ( true ) ; var data = ( fabric . StaticCanvas . supports ( 'toDataURLWithQuality' ) ) ? canvasEl . toDataURL ( 'image/' + format , quality ) : canvasEl . toDataURL ( 'image/' + format ) ; this . renderAll ( ) ; return data ; }
Exports canvas element to a dataurl image.
@method toDataURL
@param {String} format the format of the output image. Either "jpeg" or "png".
@param {Number} quality quality level (0..1)
@return {String}
Exports canvas element to a dataurl image .