com.lowagie.toolbox.plugins

Class Watermarker

public class Watermarker extends AbstractTool

This tool lets you add a text watermark to all pages of a document.

Since: 2.1.1 (imported from itexttoolbox project)

Field Summary
FileArgumentdestfile
Constructor Summary
Watermarker()
This tool lets you add a text watermark to all pages of a document.
Method Summary
protected voidcreateFrame()
Creates the internal frame.
voidexecute()
Executes the tool (in most cases this generates a PDF file).
protected FilegetDestPathPDF()
Gets the PDF file that should be generated (or null if the output isn't a PDF file).
static voidmain(String[] args)
This methods helps you running this tool as a standalone application.
voidvalueHasChanged(AbstractArgument arg)
Indicates that the value of an argument has changed.

Field Detail

destfile

FileArgument destfile

Constructor Detail

Watermarker

public Watermarker()
This tool lets you add a text watermark to all pages of a document.

Method Detail

createFrame

protected void createFrame()
Creates the internal frame.

execute

public void execute()
Executes the tool (in most cases this generates a PDF file).

getDestPathPDF

protected File getDestPathPDF()
Gets the PDF file that should be generated (or null if the output isn't a PDF file).

Returns: the PDF file that should be generated

Throws: InstantiationException

main

public static void main(String[] args)
This methods helps you running this tool as a standalone application.

Call it like this from command line: java com.lowagie.tools.plugins.Watermarker input.pdf Draft 230 0.2 output.pdf

"input.pdf" is the input file name to be processed

"Draft" is the text written as transparent "watermark" on top of each page

"230" is the font size

"0.2" is the opacity (1.0 completely opaque, 0.0 completely transparent)

"output.pdf" is the output file name

Call it from within other Java code:

Watermarker.main(new String[]{"input.pdf","Draft","230","0.2","output.pdf"});

Parameters: args the srcfile, watermark text and destfile

valueHasChanged

public void valueHasChanged(AbstractArgument arg)
Indicates that the value of an argument has changed.

Parameters: arg the argument that has changed