簡體   English   中英

Websupergoo ABCPDF.NET - 在調用 doc.Read() 之前檢查 pdf 是否加密/密碼保護

[英]Websupergoo ABCPDF.NET - check if the pdf is encrypted/password protected before calling doc.Read()

如果 pdf 文件已加密且未傳遞密碼,doc.Read(filePath) 將出錯。 在調用 doc.Read() 之前,我一直無法找到一種方法來檢查 pdf 文檔是否已加密,因此我可以更好地處理這種情況。 有人知道辦法嗎?

檢查文檔加密類型為 2?

bool encrypted = false;
using (Doc theDoc = new Doc())
{
    XReadOptions options = new XReadOptions { ReadModule = MyPDF.Pdf };
    theDoc.Read(inputbytearray, options);
    if (theDoc.Encryption.Type == 2)
      encrypted = true;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM