我想将 html 部分转换为图像(注意Html 部分有许多来自服务器的其他图像)我使用 Angular 6 和 Node.js,将 html 部分转换为图像的库是 dom-to-img
它正在本地主机中工作,但是当我将其测试到生产级别时,它给了我错误,如图所示
这是我想要转换为图像的 HTML 区域,其中签名和背面蓝色来自服务器作为 URL

我使用 @ViewChild('checkContainer') 容器;获取 dom(Html 部分)引用,然后我调用一个函数,该函数为我提供一个图像类型文件,然后传递到将该图像保存在数据库中的服务器。 一切都在本地主机上运行,但在生产中不起作用
这是我尝试过的代码。
async convertToImage(fileName) {
try {
const blob = await domtoimage.toBlob(this.container.nativeElement);
this.checkImageFile = new File([blob], fileName + '.png', {
type: 'image/png'
}); // image File
} catch (error) {
console.log('ops error', error);
}
Run Code Online (Sandbox Code Playgroud)
}
上面的函数将从该函数调用checkImageFile是我的文件中声明的属性名称。
async addCheck() {
const fileName = this.checkModel.checkNumber;
await this.convertToImage(fileName);
if (this.checkImageFile) {
console.log(this.checkImageFile);
} else {
console.log('dom …Run Code Online (Sandbox Code Playgroud)