简体   繁体   English

JSPDF在转换后的PDF中添加黑色背景

[英]JSPDF adding a black background to converted PDF

When I use JSPDF to convert from a PNG to PDF, wherever the PNG is transparent, JSPDF puts a black background in. Where can I find the code in the library to change this from black to white? 当我使用JSPDF将PNG转换为PDF时,无论PNG是透明的,JSPDF都会放置黑色背景。在哪里可以找到在库中将其从黑色更改为白色的代码?

I am open to suggestions other than updating the library. 除了更新库之外,我也乐于接受其他建议。

I solved this by using before I drew the image to the canvas. 我通过在将图像绘制到画布之前使用来解决此问题。

context.fillStyle = "#FFFFFF";
context.fillRect(0,0,width,height);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM