c# - 使用 C# 加密 PDF 文档

标签 c# pdf encryption

<分区>

是否可以使用对称加密来加密 pdf 的内容? acrobat等是否支持自动解密?

我需要一个 c#/.net 中的 api 来加密文件的内容!

亲切的问候 迈克尔

最佳答案

Atalasoft PDF library (dotImage 的一部分)可以为您处理 PDF 文档的加密或解密(免责声明,我在 Atalasoft 工作并编写了库)。代码非常简单:

public void EncryptPdf(Stream input, Stream output, string userPassword, string ownerPassword)
{
    if (input == output) throw new ArgumentExeption("input", "input and output must be different");
    PdfDocument doc = new PdfDocument(input);
    // at this point if you set doc.Permissions, you can fine-control what can be
    // done to the document.  If userPassword is null, then the document can be opened
    // without a password prompt, but will be restricted to the permissions.
    // Permissions includes things like Printing, Modifying, Copying Text etc.
    doc.Save(userPassword, ownerPassword, output);
}

关于c# - 使用 C# 加密 PDF 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7189609/

相关文章:

c# - ModelState 有效,但是当我保存数据时,我在有错误的entityValidationErrors 中得到它

c# - 使用 BinaryFormatter 附加到文件

c# - LINQPad:使用 (.NET4) VS2010 程序集时出现 "BadImageFormatException"?

java - 使用 AES-CBC-PKCS5Padding 解密数据时出现填充错误

oracle - 为什么 STANDARD_HASH ('expr' 、 'MD5' ) 的结果始终为大写?

c# - 在 LINQ 查询中调用 .AsParallel() 的位置

java - 如何在 JSP 中打开 PDF 文件

android - Agora.io 文字聊天时发送图片和pdf

linux - 基于文件名的目录,然后将关联的文件移动到正确的目录以获得随机名称

C 段错误字符指针