Yes, with certain limitations.
It is difficult, but not impossible, to determine what is already on the existing page.
If all you want to do is add “page X of Y” to the lower left corner of all your pages, simply .
PdfReader reader = new PdfReader( inPath );
PdfStamper stamper = new PdfStamper( reader, new FileOutputStream( outPath ) );
BaseFont font = BaseFont.createFont();
for (int i = 0; i < reader.getNumberOfPages(); ++i) {
PdfContentByte overContent = stamper.getOverContent( i + 1 );
overContent.saveState();
overContent.beginText();
overContent.setFontAndSize( font, 10.0f );
overContent.setTextMatrix( xLoc, yLoc );
overContent.showText( "Page " + (i + 1) + " of " + reader.getNumberOfPages() );
overContent.endText();
overContent.restoreState();
}
stamper.close();
A large watermark is not much more complicated. Adding things to a PDF in one or more predefined locations is feasible.
" ". . PDF .
, , . , .