The application allows the user to save the design and post it so that other users can view it later.
The original canvas was saved with the proportions width = 700 and height = 600. But when displaying the canvas, I want to resize the canvas so that it fits in the dimensions (350 300). half of the original. But if I directly apply these sizes and load widths to setWidth () and setHeight (), it loads with the original proportions.
All I want to do is show the canvas with new dimensions.
Previously posted here .
I'm not sure what you tried, but
var canvas = document.getElementsByTagName('canvas')[0]; canvas.width = 800; canvas.height = 600;
should work fine.
fabric.js, .
, "canvas" - fabric.js, , :
canvas.setWidth( <desired width> ); canvas.setHeight( <desired height> ); canvas.calcOffset();