开发者

Verify if a PDF is secured/protected with iTextSharp

开发者 https://www.devze.com 2023-03-31 17:35 出处:网络
Is it possible to verify if we can copy the content of a PDF document with iTextSharp? I have a method that copy the content of the PDF and add a new page at the end with project\'s information but

Is it possible to verify if we can copy the content of a PDF document with iTextSharp?

I have a method that copy the content of the PDF and add a new page at the end with project's information but it throw a "System.ArgumentException: PdfReader not opened with owner开发者_开发知识库 password". I get this error when I do writer.GetImportedPage(reader, i);

Thanks for the help!


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

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

精彩评论

暂无评论...
验证码 换一张
取 消