本文整理匯總了Java中com.itextpdf.text.pdf.PdfWriter.setEncryption方法的典型用法代碼示例。如果您正苦於以下問題:Java PdfWriter.setEncryption方法的具體用法?Java PdfWriter.setEncryption怎麽用?Java PdfWriter.setEncryption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.itextpdf.text.pdf.PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.setEncryption方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildPdfDocument
import com.itextpdf.text.pdf.PdfWriter; //導入方法依賴的package包/類
public void buildPdfDocument(OutputStream toWrite, final String name, final int treeCount, String[] codeFragments, String imagePath) throws Exception {
// create pdf
final Document doc = new Document();
final PdfWriter pdfWriter = PdfWriter.getInstance(doc, toWrite);
pdfWriter.setEncryption(null, null, PdfWriter.ALLOW_DEGRADED_PRINTING | PdfWriter.ALLOW_PRINTING, PdfWriter.STANDARD_ENCRYPTION_128);
_imagePath = imagePath;
doc.open();
PdfContentByte cb = pdfWriter.getDirectContent();
PdfHelper.createHeaderBlock(cb,1,1);
PdfHelper.createCircleAndText(cb, "Gutschein", 298f, 705f, 75, textFontForCircle, 0x7F, 0xAD, 0x09);
createBlueBlock(cb, treeCount);
createGreyBlock(cb, codeFragments);
pdfHelper.addLogo(cb, _imagePath, 262f, 35f);
doc.close();
}
示例2: writePdfDataToOutputStream
import com.itextpdf.text.pdf.PdfWriter; //導入方法依賴的package包/類
public void writePdfDataToOutputStream(OutputStream toWrite, final int treeCount, final String text, final String name, final String number, String imagePath) throws Exception {
// create pdf
final Document doc = new Document();
final PdfWriter pdfWriter = PdfWriter.getInstance(doc, toWrite);
pdfWriter.setEncryption(null, null, PdfWriter.ALLOW_DEGRADED_PRINTING | PdfWriter.ALLOW_PRINTING, PdfWriter.STANDARD_ENCRYPTION_128);
final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+2"), Locale.GERMAN);
cal.setTimeInMillis(System.currentTimeMillis());
final String date = cal.get(Calendar.DAY_OF_MONTH) + "." + (cal.get(Calendar.MONTH) + 1) + "." + cal.get(Calendar.YEAR);
_imagePath = imagePath;
doc.open();
PdfContentByte cb = pdfWriter.getDirectContent();
PdfHelper.createHeaderBlock(cb,1,1);
PdfHelper.createCircleAndText(cb, "Zertifikat", 298f, 665f, 75f, textFontForCircle, 0x9E, 0x3C, 0x59);
createTreeCountAndCustomTextBlock(cb, text, treeCount);
createLawTextDateAndSignatureBlock(cb, number, date);
pdfHelper.addLogo(cb, imagePath, 262f, 20f);
doc.close();
}
示例3: writePdfDataToOutputStream
import com.itextpdf.text.pdf.PdfWriter; //導入方法依賴的package包/類
public void writePdfDataToOutputStream(OutputStream toWrite, final int treeCount, final String text, final String name, final String number, String imagePath) throws Exception {
// create pdf
final Document doc = new Document();
final PdfWriter pdfWriter = PdfWriter.getInstance(doc, toWrite);
pdfWriter.setEncryption(null, null, PdfWriter.ALLOW_DEGRADED_PRINTING | PdfWriter.ALLOW_PRINTING, PdfWriter.STANDARD_ENCRYPTION_128);
final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+2"), Locale.GERMAN);
cal.setTimeInMillis(System.currentTimeMillis());
final String date = cal.get(Calendar.DAY_OF_MONTH) + "." + (cal.get(Calendar.MONTH) + 1) + "." + cal.get(Calendar.YEAR);
_imagePath = imagePath;
doc.open();
PdfContentByte cb = pdfWriter.getDirectContent();
PdfHelper.createHeaderBlock(cb,1,1);
PdfHelper.createCircleAndText(cb, "Zertifikat", 298f, 665f, 75f, textFontForCircle, 0x9E, 0x3C, 0x59);
createTreeCountAndCustomTextBlock(cb, text, treeCount);
createLawTextDateAndSignatureBlock(cb, number, date);
pdfHelper.addLogo(cb, _imagePath, 262f, 20f);
doc.close();
}