【问题标题】:GoJS full image download not just the section in the viewportGoJS 完整图像下载不仅仅是视口中的部分
【发布时间】:2018-09-05 08:48:51
【问题描述】:

我正在尝试将图像下载为 blob。但问题是只有在视口中的图像部分被下载。我希望下载整个图像。

这是我正在使用的功能:

downloadER() {
    this.diagram.rebuildParts();
    const downloadCallback = (blob: any): void => {
      var url = window.URL.createObjectURL(blob);
      var reader = new FileReader();
      reader.onloadend = () => {
        var imageDataUrl = reader.result;
        var img = document.createElement("img");
        img.src = imageDataUrl; // For getting the height and width
        let pdf = new jspdf('p', 'mm', 'b2');
        var position = 0;
        pdf.setFontSize(20);
        pdf.text(breadcrumb, 250, 20, 'center');
        pdf.addImage(imageDataUrl, 'PNG', 0, 25, position, img.naturalWidth, img.naturalHeight);
        pdf.save(pdfTitle + ".pdf");
      };
      reader.readAsDataURL(blob);
    }
    let blob = this.diagram.makeImageData({ background: "white", returnType: "blob", callback: <any>downloadCallback});
  }

如何下​​载完整图片。

【问题讨论】:

    标签: javascript angular image gojs


    【解决方案1】:

    { scale: 1 } 添加到您的选项中,它将使用整个文档边界,而不仅仅是视口中的内容。

    【讨论】:

      猜你喜欢
      • 2018-06-08
      • 2012-09-17
      • 1970-01-01
      • 2017-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-23
      • 2015-12-02
      相关资源
      最近更新 更多