如何使用密码在.net中创建PDF文件

编程入门 行业动态 更新时间:2024-10-25 15:32:00
本文介绍了如何使用密码在中创建PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在pdf文件中返回创建代码。但它显示错误 我的代码:

hi here i return my code for creation on pdf file. but it is showing error my code:

public void pdf() { int i = 0; // r is for random file names... Random r = new Random(); i = r.Next(1, 999999999); string filename = i.ToString() + ".pdf"; //path where to save... string path = "D:/Test/" + filename; Document document = new Document(); PdfWriter writer; writer = PdfWriter.GetInstance(document, new FileStream(path, System.IO.FileMode.Create)); // Set password ...replace mypass with your password ....... writer.SetEncryption(PdfWriter.STRENGTH128BITS, "mypass", null, PdfWriter.AllowCopy); document.Open(); //document as many properties .. for time begin i am using only one .. //document.add is to add contant to your file.. document.Add(new Paragraph("This document is Top Secret!")); document.Close(); }

推荐答案

如果您使用外部库,至少告诉我们它是什么。您最好的选择是阅读文档并在论坛上询问您正在使用的产品, If you use an external library, at least tell us what it is. Your best bet is to read the docs and ask on the forums for the product you;re using,

更多推荐

如何使用密码在.net中创建PDF文件

本文发布于:2023-10-31 01:47:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544630.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   密码   文件   net   PDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!