paper.scaleContentToFit([opt])

Scale the paper content so that it fits the paper dimensions. If opt.padding is set (default is 0), there will be an additional padding in the resulting, scaled, paper content. If opt.preserveAspectRatio is defined (default is true), the aspect ratio of the scaled paper content will be preserved. opt.minScaleX, opt.minScaleY, opt.maxScaleX and opt.maxScaleY can be optionally used to set the minimum and maximum allowed scale factor for both axis. opt.scaleGrid is a number that will be used to as a rounding factor for the resulting scale. For example, if the resulting scale factor is calculated to be 1.15 and your opt.scaleGrid is set to 0.2, then the resulting scale factor will be rounded to 1.2. Last option is opt.fittingBBox which can be an object of the form { x: [number], y: [number], width: [number], height: [number] } and is the area of the paper that should be scaled. By default opt.fittingBBox is { x: 0, y: y, width: paper.options.width, height: paper.options.height }, i.e. the whole paper area. If the method called a "scale" event can be triggered on the paper. To try it yourself see paper demo.