1

when I set the width and height of canvas in pixels, its works fine but when I set the width and height like '10cm' or something, it doesn't works. What am I doing wrong? can we only set the canvas in pixels? not in any other? I am working on SVG and convert it to canvas to save as image file, my SVG canvas's width and height is in cm so I want that canvas should be in cm too, otherwise the final image crops the data of SVG.

AliSavi
  • 53
  • 5
  • 2
    Only for print, there is no way to know the size of the display so it can not be done for display devices. – Blindman67 May 17 '17 at 16:09
  • 1
    https://www.w3.org/TR/css3-values/#absolute-lengths – Robert Longson May 17 '17 at 18:01
  • For your problem, the HTMLImage that holds your svg image has `naturalWidth` and `naturalHeight` properties, always in px. Only IE is not able to produce these... – Kaiido May 18 '17 at 00:48

0 Answers0