1904labs / dom-to-image-more

Generates an image from a DOM node using HTML5 canvas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

border

Kazturin opened this issue · comments

Hello.
Each element has a border as a result.

Had to pull down the code and fix this one for what I'm doing. After a little bit of playing around, the problem method was copyOptions() under toSvg() on line 91 in dom-to-image-more.js.

I just ended up copy pasting dom-to-image-more.js into my project, deleted that line and method, and the border issue was solved. This was enough for my use case. I didn't need to use copyDefaultStyles, imagePlaceholder, cacheBust, etc.

What was the specific change you needed, would be happy to integrate.

Just to give some context to what the issue looked like, for whatever reason, I was getting gray borders around each div in my generated images (ignore watermarks):

image

Deleting copyOptions() gave me correct images:

image

I'm not sure why this fixes things. I did not dive that deep into it. Only deduced what method was causing the issue and deleted it without problems.

In reference to the specific change, I guess you could integrate an optional parameter to skip applying options?

Just to give some context to what the issue looked like, for whatever reason, I was getting gray borders around each div in my generated images (ignore watermarks):只是为了提供一些背景信息来说明问题的情况,无论出于何种原因,我在生成的图像中的每个 div 周围都出现了灰色边框(忽略水印):

image

Deleting copyOptions() gave me correct images:删除 copyOptions() 给了我正确的图像:

image

I'm not sure why this fixes things. I did not dive that deep into it. Only deduced what method was causing the issue and deleted it without problems.我不知道为什么这可以解决问题。我并没有深入研究它。仅推断出导致问题的方法并将其删除,没有出现任何问题。

In reference to the specific change, I guess you could integrate an optional parameter to skip applying options?关于具体的更改,我想您可以集成一个可选参数来跳过应用选项?

I deleted it but the problem is not solved, there is still a border.
image

Is there no solution yet? This issue preventing us to use this library

I still need a minimal repro as a JSFiddle, please

Use html-to-image as an alternative.

+1 on this issue. Struggling to find a fix for this locally. For context. dom-to-image library was working well (but would sometimes silently fail) and after switching to this new library I am getting the gray borders.

I tried the html-to-image toBlob along with FileSaver and it has resolved the problem.

In the options, I set copyDefaultStyles: false and that seems to have fixed the border issue for me without any adverse effects on my images.