从下载iTextSharp的源代码或DLL。
利用iTextSharp,从C#、VB等.Net下语言处理PDF文件,不用安装Acrobat,确实方便。
using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text.pdf;
using System.IO;
namespace PDFSecurity
{
class PDFEncry
{
public static void Encry(string pdfSrc, string pdfDest, bool strength,
string userPassword, string ownerPassword, int permissions)
{
PdfReader reader = new PdfReader(pdfSrc);
Stream os = (Stream)(new FileStream(pdfDest, FileMode.Create));
PdfEncryptor.Encrypt(reader, os, strength, userPassword, ownerPassword, permissions);
}
}
}