HTML2canvas生成模糊图像 [英] HTML2canvas generates Blurry images
问题描述
我使用jsPDF,它使用html2canvas从一些html元素生成图像并插入.pdf文件。但是在html2canvas有一个问题,它从html生成模糊的图像。请参阅以下示例:
I am using jsPDF and it uses html2canvas to generate an image from some html element and insert on the .pdf file. But there is a problem on html2canvas, it generates blurry images from the html. See example below:
HTML内容:
html2canvas生成的图片:
html2canvas generated image:
有任何方法来修复它,或有什么更好的选择获取图像形式html?
Is there any way to fix it or is there any better option to get the image form html?
谢谢!
推荐答案
我发现了我的问题。发生我的屏幕是一个Retina显示,所以当canvas2html将渲染HTML,由于视网膜屏幕上的像素密度的差异,图像被模糊。
I have found out my problem. Happens that my screen is a Retina Display, so when the canvas2html will render the HTML, due to the difference of pixel density on retina screen, the image is rendered blurred.
在此找到解决方案:
https://github.com/cburgmer/rasterizeHTML.js/blob/master/examples/retina.html
这篇关于HTML2canvas生成模糊图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!