checking if pdf is password protected using itextsharp

前端 未结 4 980
情歌与酒
情歌与酒 2020-12-15 13:06

I want to check if a pdf file is password protected or not to view. That is i want to know if the pdf file has user password or not.

I found some help in some forum

4条回答
  •  天涯浪人
    2020-12-15 14:05

    Reference : Check for Full Permission

    You should be able to just check the property PdfReader.IsOpenedWithFullPermissions.

    PdfReader r = new PdfReader("YourFile.pdf");
    if (r.IsOpenedWithFullPermissions)
    {
        //Do something
    }
    

提交回复
热议问题