您的位置:首页 > 其它

pdf文件加密(iText)

2008-09-05 15:46 302 查看
package com.tanling.act;
import java.io.FileOutputStream;
import com.lowagie.text.pdf.PdfEncryptor;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.PdfReader;
public class PdfEncrytor {
public PdfEncrytor(){
}
/**
* pdf文件加密
*
* @param filePath 文件路径
* @param outPath 输出路径
*/
public void PdfEncryptor(String filePath, String outPath){//@date 2008-8-22
System.out.println(filePath);
try {
PdfReader reader = new PdfReader("ChapterSection.pdf");
PdfEncryptor.encrypt(reader,
new FileOutputStream(outPath),
null,
null,
PdfWriter.ALLOW_PRINTING,
false);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: