Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 基于SVG的UI 6的屏幕截图_Angular_Svg - Fatal编程技术网

Angular 基于SVG的UI 6的屏幕截图

Angular 基于SVG的UI 6的屏幕截图,angular,svg,Angular,Svg,我们必须在应用程序(Angular 6+Bootstrap)中添加一个包含SVG的功能,我尝试使用html2canvas,但SVG并没有作为屏幕截图的一部分出现 html2canvas(this.screen.nativeElement).then( canvasres => { this.canvas1.nativeElement.src = canvasres.toDataURL(); this.downloadLink.nativeElement.href = canvas

我们必须在应用程序(Angular 6+Bootstrap)中添加一个包含SVG的功能,我尝试使用html2canvas,但SVG并没有作为屏幕截图的一部分出现

 html2canvas(this.screen.nativeElement).then( canvasres => {
  this.canvas1.nativeElement.src = canvasres.toDataURL();
  this.downloadLink.nativeElement.href = canvasres.toDataURL('image/png');
  this.downloadLink.nativeElement.download = 'screenshot.png';
  this.downloadLink.nativeElement.click();
 });
});

您能建议我们如何实现此UI的截图吗?

将SVG添加到画布会污染它们:它们无法再保存。我认为同样的情况也发生在画布上。如果你想解决这个问题,你应该直接在画布上画图,或者干脆让图像可以下载。我们通过使用navigator.mediadevices选项解决了这个问题,它需要全屏截图,但效果很好。将SVG添加到画布会污染它们:它们无法再保存。我认为同样的情况也发生在画布上。如果你想解决这个问题,你应该直接在画布上画图,或者干脆让图像可以下载。我们通过使用navigator.mediadevices选项解决了这个问题,它需要全屏截图,但它可以工作。