throw new InstantiationException(
"You need to add a text for the watermark");
}
int fontsize = Integer.parseInt((String) getValue("fontsize"));
float opacity = Float.parseFloat((String) getValue("opacity"));
BaseFont bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI,
false);
PdfReader reader = new PdfReader(((File) getValue("srcfile"))
.getAbsolutePath());
int pagecount = reader.getNumberOfPages();
PdfGState gs1 = new PdfGState();
gs1.setFillOpacity(opacity);
String text = (String) getValue("watermark");
PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(
(File) getValue("destfile")));
float txtwidth = bf.getWidthPoint(text, fontsize);
for (int i = 1; i <= pagecount; i++) {
PdfContentByte seitex = stamp.getOverContent(i);
Rectangle recc = reader.getCropBox(i);
float winkel = (float) Math.atan(recc.getHeight() /
recc.getWidth());