这是一个笨拙的链接。我pdfSample.js
使用节点运行,pdfsample.html
是要转换为 pdf 并generatepdf.html
用于获取它的实际数据。
当我运行它时,它向我显示一个错误Failed to load Pdf Document
。我参考了这个样本。我没有得到任何问题,为什么它不起作用?
$http.get(url, {responseType: 'arraybuffer'}).then(function successCallback(response){
console.log(response);
var file = new Blob([response], {type: 'application/pdf'});
console.log(file);
var fileURL = URL.createObjectURL(file);
$scope.loading = false;
q.resolve(fileURL);
},
function errorCallback(response){
$scope.loading = false;
q.reject(response);
});
/* .success(function (response) {
})
.error(function (err) {
});*/
return q.promise;
};