本文整理汇总了Java中com.lowagie.text.pdf.PdfWriter.setPageEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java PdfWriter.setPageEmpty方法的具体用法?Java PdfWriter.setPageEmpty怎么用?Java PdfWriter.setPageEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.pdf.PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.setPageEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateBlankPdf
import com.lowagie.text.pdf.PdfWriter; //导入方法依赖的package包/类
/**
* Genera un pdf vac�o
* @param os
* @throws Exception
*/
public static void generateBlankPdf(OutputStream os) throws Exception
{
Document document = new Document(PageSize.A4);
PdfWriter writer = PdfWriter.getInstance(document,os);
writer.setEncryption(null, null, PdfWriter.AllowCopy | PdfWriter.AllowPrinting, PdfWriter.STRENGTH40BITS);
document.open();
document.newPage();
writer.setPageEmpty(false);
document.close();
}
示例2: main
import com.lowagie.text.pdf.PdfWriter; //导入方法依赖的package包/类
/**
* Creates a PDF document with different pages.
*/
@Test
public void main() throws Exception {
// step 1: creation of a document-object
Document document = new Document();
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.getInstance(document, PdfTestBase.getOutputStream("NewPage.pdf"));
// step 3: we open the document
document.open();
// step 4:
document.add(new Paragraph("This is the first page."));
document.newPage();
document.add(new Paragraph("This is a new page"));
document.newPage();
document.newPage();
document.add(new Paragraph(
"We invoked new page twice, yet there was no blank page added. Between the second page and this one. This is normal behaviour."));
document.newPage();
writer.setPageEmpty(false);
document.newPage();
document.add(new Paragraph("We told the writer the page wasn't empty."));
document.newPage();
document.add(Chunk.NEWLINE);
document.newPage();
document.add(new Paragraph("You can also add something invisible if you want a blank page."));
document.add(Chunk.NEXTPAGE);
document.add(new Paragraph("Using Chunk.NEXTPAGE also jumps to the next page"));
// step 5: we close the document
document.close();
}