Blob字符串URL到PDF

时间:2015-12-16 08:52:30

标签: javascript pdf svg blob

我正在创建一个包含多个SVG的blob url字符串

  

团块:文件%3A /// 45525ac9-caa6-4a48-aa8f-aab1ff6c9e7e

我也可以使用iframe打印。

function closePrint () {
  document.body.removeChild(this.__container__);
}

function setPrint () {
  this.contentWindow.__container__ = this;
  this.contentWindow.onbeforeunload = closePrint;
  this.contentWindow.onafterprint = closePrint;
  this.contentWindow.focus(); // Required for IE
  this.contentWindow.print();
}

function printPage (sURL) {
  var oHiddFrame = document.createElement("iframe");
  oHiddFrame.onload = setPrint;
  oHiddFrame.style.visibility = "hidden";
  oHiddFrame.style.position = "fixed";
  oHiddFrame.style.right = "0";
  oHiddFrame.style.bottom = "0";
  oHiddFrame.src = sURL;
  document.body.appendChild(oHiddFrame);
}

 printPage(fileURL);

但是如何在javascript中下载与PDF相同的网址内容?

1 个答案:

答案 0 :(得分:0)

你基本上问的是如何将SVG转换为PDF,对吧?要么在服务器端执行,要么在JavaScript中完成它:请查看PDFKit