[英]Rendering pdf blob on Chrome
我在另一個線程上問了類似的問題,但我得到了一個答案,該答案適用於Firefox,但不適用於chrome,因為chrome會阻止彈出窗口。
我嘗試使用按鈕打開文件,但文件沒有重做。
<div class="uploadButtonSection">
<input type="image" src="clip.png" ngf-select="uploadFiles($files)" multiple
accept="application/pdf" ngf-max-height="1000" ngf-max-size="5MB" class="uploadIcon"/>
<ul class="uploadList">
<li ng-repeat="file in files" style="font:smaller">
<div class="attachmentIcon">
<img src="pdf-icon.png" ng-click="openFile(file)">
<div class="customBtn" ng-click="removeFile(file)">Remove</div>
{{file.name}}
</div>
</li>
</ul>
$scope.openFiles = function(file){
var url = URL.createObjectURL(file);
window.open(url,"_blank");
};
嘗試這個:
var url = URL.createObjectURL(new Blob(file, {type: 'application/pdf'}));
window.open(url);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.