question First, let me talk about the problem I encountered. First of all, there is such a demand. The front end needs to dynamically generate pictures based on the data sent from the back end. The text, background image, and user avatar in the picture are all obtained through the backend interface. However, some images were successfully generated in the canvas using the canvas generated by html2canvas. But some pictures cannot be displayed no matter what. Official Documentation I worked on the project for a long time without success, and searched on Google for a long time without success. There was a bit of despair at this moment. Suddenly it occurred to me, why not go to its official website. So I saw the following content on the official website.
What is it about? Here is a translation for those who are not good at English. Those who are good at English can read the above text directly. The general meaning is that in html2canvas, scripts are used to operate, that is, scripts are used to convert HTML into canvas, but there is a limitation, that is, cross-source images cannot be used. If used, html2canvas will not read the resource. This is why some images on the converted canvas are always blank. If there are other canvases on the page that also use cross-origin image resources, html2canvas will not read them. Solution Just forward the static resources once and allow loading cross-origin resources in the html2canvas configuration. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Docker uses a single image to map to multiple ports
>>: Object.entries usage you don't know in JavaScript
Use Javascript to achieve the countdown effect, f...
1. Requirements When using the Vue.js framework t...
Go to https://dev.mysql.com/downloads/mysql/ to d...
To achieve the background color flashing effect, j...
I think editors are divided into two categories, ...
This article mainly introduces the binary type op...
As a required course for front-end developers, CS...
1. Install MySQL (1) Unzip the downloaded MySQL c...
This article example shares the specific code of ...
1.device-width Definition: Defines the screen vis...
1. Create a project with vue ui 2. Select basic c...
When releasing a project, you will often encounte...
This article shares the specific code of videojs+...
【Problem Analysis】 We can use the chown command. ...
union execution For ease of analysis, use the fol...