验证是否PDF固定/保护与iTextSharp的 [英] Verify if a PDF is secured/protected with iTextSharp

查看:719
本文介绍了验证是否PDF固定/保护与iTextSharp的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以验证,如果我们可以复制与iTextSharp的PDF文档的内容?

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

我有复制PDF的内容,并在与项目信息的末尾添加一个新的页面,但它抛出一个System.ArgumentException方法:PdfReader不开所有者密码。我得到这个错误,当我做 writer.GetImportedPage(读者,我!);

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);

感谢您的帮助

推荐答案

您应该能够只检查属性 PdfReader.IsOpenedWithFullPermissions

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

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

这篇关于验证是否PDF固定/保护与iTextSharp的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆