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
This article describes how to configure a seconda...
Table of contents Overview Why choose a framework...
Today I used a virtual machine to do an experimen...
1. What is Parallax scrolling refers to the movem...
First, let’s take a look at the picture: Today we...
Table of contents Event-driven and publish-subscr...
Box-sizing in CSS3 (content-box and border-box) T...
1.1 Download the binary installation package wget...
What I want to share today is to use native JS to...
Table of contents 1. Install Docker 2. Pull the J...
1. Introduction to Navicat 1. What is Navicat? Na...
Introduction yum (Yellow dog Updater, Modified) i...
This article uses an example to describe how MySQ...
mistake The following error occurs when connectin...
Table of contents 1. Synchronization Principle 2....