A Java program that uses jPDFPrint to print a PDF document and adds a watermark on every page. We defined an interface called IWatermark that makes it easy for users to define and customize their own watermark, including text, font, color, location and orientation by simply using the well-known Graphics2D Java class.

// Load PDF document
PDFPrint pdfPrint = new PDFPrint("input.pdf", null);
 
// Create the watermark by implementing the IWatermark interface
IWatermark watermark = new IWatermark() {
 public void drawWatermark(Graphics2D g, int type, int pageIndex, int pageWidth, int pageHeight)
 {
  // Watermark color (this can have transparency, but Java then makes the spool file very large)
  g.setColor(new Color(128, 128, 128));
 
  // Set the font
  g.setFont(new Font("sansserif", Font.PLAIN, 100));
 
  // Draw the watermark string, rotated 45 degrees
  g.rotate(Math.toRadians(45));
  g.drawString("Watermark", 150, g.getFontMetrics().getMaxDescent());
 }
};
 
// Set the watermark on the document
pdfPrint.setWatermark(watermark);
 
// Print to default printer
pdfPrint.printToDefaultPrinter(null);

Download Full Java Sample
http://www.qoppa.com/files/pdfprint/guide/sourcesamples/Watermark.java