Example usage for com.lowagie.text.pdf PdfCopy createPageStamp

List of usage examples for com.lowagie.text.pdf PdfCopy createPageStamp

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfCopy createPageStamp.

Prototype

public PageStamp createPageStamp(PdfImportedPage iPage) 

Source Link

Document

Create a page stamp.

Usage

From source file:questions.importpages.ConcatenateWithTOC.java

public static PdfImportedPage getStampedPage(PdfReader reader, PdfCopy copy, int oldP, int newP, BaseFont bf)
        throws IOException {
    PdfImportedPage page = copy.getImportedPage(reader, oldP);
    PageStamp pagestamp = copy.createPageStamp(page);
    PdfContentByte canvas = pagestamp.getOverContent();
    canvas.beginText();/*ww  w . j  a va 2 s.co  m*/
    canvas.setFontAndSize(bf, 12);
    canvas.showTextAligned(Element.ALIGN_LEFT, "page " + newP, 36, 26, 0);
    canvas.endText();
    pagestamp.alterContents();
    return page;
}