[英]Unable to open password protected pdf in angular application
我在我的 angular 應用程序中使用pdfjs-dist來渲染 pdf。 但我無法打開受密碼保護的 pdf。 有沒有其他方法可以驗證文檔的密碼並打開它。
使用下面的代碼。
let pdfJs= require('pdfjs-dist');
pdfJs.getDocument({ url: 'my.pdf', password: 'your password' }).then(function(pdf)
{
let text = [];
for(let i = 1; i <= pdf.numPages; i++) {
pdf.getPage(i).then(function(page) {
page.getTextContent().then(function(data) {
for(let j = 0; j < data.items.length; j++) {
text.push(data.items[j].str);
}
});
});
}
}).catch(function(error) {
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.