I am creating a canvas using fabric JS with a dynamic size in admin panel and adding objects into it, after modifying the canvas I am storing the JSON data into the database (using: canvas.toJSON() ).
Now i have displayed a canvas in the front-end for editing using that stored JSON data from the database ( canvas.loadFromJSON(canvasData, this.canvas.renderAll.bind(this.canvas)) ). If I use the same width and height of the canvas it is showing perfectly. But with different width and height of the canvas, the objects are not showing in the proper position sometimes objects getting chopped.
For example, I have created a canvas with 1200*1000px in the admin now I want to load the canvas data into an 800*500px canvas window with the objects in the same place. As if the original canvas is larger then I still have to fit the entire canvas data into the front-end so I need to load the canvas into a smaller canvas window.
I have followed Canvas client size in fabric js
var canvas = new fabric.Canvas('c', {width: 640, height: 360});
canvas.setDimensions({width: 1280, height: 720}, {backstoreOnly: true});
When using the above code if original template size is large 3000*2000px and fits it into a 600*600px window
the text in the canvas showing very small to read but when generating an image from the canvas it shows properly.
See the picture
See the picture How can I fix this? Thanks in advance