2017-09-04 71 views
0

我正在尝试使用画布元素,但高度不能超过16384像素。如果我尝试16385像素,我在IE11中获得IndexSizeError。这在Chrome中正常工作。画布用于PDF生成,我没有时间将代生成到服务器。什么决定了IE11中画布html元素的最大尺寸?

我google了一下,看起来大小可能会因平台和浏览器的不同而不同。

是否由浏览器分配内存和内存设置来决定这一点?

编辑:我发现了一些信息here

Note The maximum size of the rendered area on a canvas is from 0,0 to 8192 
x 8192 pixels, regardless of the size of the canvas. For example, a canvas  
is created with a width and height of 8292 pixels. A rectangular fill is 
then applied as "ctx.fillRect (0,0, canvas.width, canvas.height)".Only the 
area within the coordinates (0, 0, 8192, 8192) can be rendered, leaving a 
100 pixel border on the right and bottom of the canvas.

看起来像我可以有两倍。也许这只是为了IE9。

回答

0

Canvas Specification表示“该元素可以通过样式表任意设置大小”,因此基于这一点以及您从链接共享的信息,IE必须实现它们自己的最大大小。 This似乎很有用,但不提供任何来源来备份显示的数字(最喜欢的答案)。

+0

我猜测尺寸已经调整好了,因为我在Chrome中使用'20184'的高度没有问题。在IE11中的大小也可能在某些时候增加。谢谢! – ptf

+0

我明白了,没问题! – jburtondev