公共字符串密码{得到;集;}
公共财产密码作为字符串
公共字符串getPassword ();
公共无效向setPassword (
以字符串
);
一个系统。字符串that contains the password to use when loading thisPDFFile对象(如果文件是加密的)。
创建对象时,也可以直接设置密码PDFFile对象通过调用PDFFile(字符串文件名,字符串密码)构造函数。
有些PDF文件是加密的,在使用之前需要输入密码。加密文件必须具有密码属性在使用对象的其他属性和方法之前设置为正确的值。使用IsEncrypted以确定PDF文件是否加密并需要密码。
设置文件名(和可选密码)后,调用负载方法来填充PDFFile对象的DocumentProperties而且页面属性的正确值。或者使用该类支持的任何其他文件特性函数。
PDF文件密码不能超过64个ASCII字符。如果需要,LEADTOOLS将自动截断密码字符串并将其转换为ASCII。设置密码的最大长度PDFDocument。MaximumPasswordLength常数。
使用Leadtools;
使用Leadtools.Codecs;
使用Leadtools.Controls;
使用Leadtools.Drawing;
使用Leadtools.ImageProcessing;
使用Leadtools.Pdf;
使用Leadtools.Svg;
使用Leadtools.WinForms;
公共无效PDFFileEncryptedExample ()
{
字符串pdfFileName1 = Path.Combine(LEAD_VARS.ImagesDir,@“Leadtools.pdf”);
字符串pdfFileName2 = Path.Combine(LEAD_VARS.ImagesDir,@“Encrypted.pdf”);
//创建一个加密版本的Leadtools.pdf
PDFFile文件=新PDFFile (pdfFileName1);
文件。SecurityOptions =新PDFSecurityOptions ();
file.SecurityOptions.UserPassword =“领导”;
文件。Convert(1, -1, pdfFileName2);
//现在尝试以文档的形式打开它
字符串密码=零;
如果(PDFFile.IsEncrypted (pdfFileName2))
{
控制台。WriteLine (“{0}\ nIs加密。输入密码:", pdfFileName2);
password = Console.ReadLine();
}
//如果用户输入了正确的密码(LEAD),您现在可以打开文件
试一试
{
文件=新PDFFile (pdfFileName2、密码);
file.Load ();
PDFDocumentProperties props = file.DocumentProperties;
控制台。WriteLine (“标题:{0}”, props.Title);
控制台。WriteLine (“作者:{0}”, props.Author);
控制台。WriteLine (主题:{0}, props.Subject);
控制台。WriteLine (“关键词:{0}”, props.Keywords);
控制台。WriteLine (“创造者:{0}”, props.Creator);
控制台。WriteLine (“制片人:{0}”, props.Producer);
控制台。WriteLine (" Created: {0}", props.Created);
控制台。WriteLine ("已修改:{0}", props.Modified);
控制台。WriteLine ("----------:");
}
抓(异常交货)
{
//否则,您将得到PDF文件已损坏的错误
Console.WriteLine (ex.Message);
}
}
静态类LEAD_VARS
{
公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;
}
进口Leadtools
进口Leadtools。编解码器
进口Leadtools.Pdf
进口Leadtools。WinForms
进口Leadtools.Svg
进口Leadtools。ImageProcessing
公共子PDFFileEncryptedExample ()
昏暗的pdfFileName1作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Leadtools.pdf”)
昏暗的pdfFileName2作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Encrypted.pdf”)
创建一个加密版本的Leadtools.pdf
昏暗的文件作为PDFFile =新PDFFile (pdfFileName1)
文件。SecurityOptions =新PDFSecurityOptions ()
file.SecurityOptions.UserPassword =“领导”
文件。Convert(1, -1, pdfFileName2)
“现在试着把它作为文件打开
昏暗的密码作为字符串=没有什么
如果PDFFile.IsEncrypted (pdfFileName2)然后
控制台。WriteLine (“{0}”&常数。vbLf &“是加密的。输入密码:"pdfFileName2)
password = Console.ReadLine()
结束如果
如果用户输入了正确的密码(LEAD),现在就可以打开文件了
试一试
文件=新PDFFile (pdfFileName2、密码)
file.Load ()
昏暗的道具作为PDFDocumentProperties =文件。DocumentProperties
控制台。WriteLine (“标题:{0}”props.Title)
控制台。WriteLine (“作者:{0}”props.Author)
控制台。WriteLine (主题:{0}props.Subject)
控制台。WriteLine (“关键词:{0}”props.Keywords)
控制台。WriteLine (“创造者:{0}”props.Creator)
控制台。WriteLine (“制片人:{0}”props.Producer)
控制台。WriteLine (" Created: {0}"props.Created)
控制台。WriteLine ("已修改:{0}"props.Modified)
控制台。WriteLine ("----------:")
抓前女友作为异常
否则,你会得到一个PDF文件已损坏的错误
Console.WriteLine (ex.Message)
结束试一试
结束子
公共NotInheritable类LEAD_VARS
公共常量ImagesDir作为字符串=“C: \ LEADTOOLS21 \ Resources \图片”
结束类
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗网络查看器net
188宝金博怎么下载
支持的平台上
.NET、Java、Android和iOS/macOS程序集
C API/ c++类库
HTML5 JavaScript库
您的邮件已发送给技术支持!应该有人联系!如果你的事情很紧急,请回来聊天。
聊天时间:
周一至周五,美国东部时间上午8:30至下午6:00
感谢您的反馈!
请再次填写表格,开始新的聊天。
所有代理目前都离线。
聊天时间:
星期一至星期五
美国东部时间上午8:30 -下午6点
如需与我们联系,请填写此表格,我们将通过电子邮件与您联系。