Class WatermarkerTool
- java.lang.Object
-
- com.lowagie.toolbox.AbstractTool
-
- com.lowagie.toolbox.plugins.watermarker.WatermarkerTool
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.util.EventListener
public class WatermarkerTool 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
Fields Modifier and Type Field Description (package private) FileArgument
destfile
-
Fields inherited from class com.lowagie.toolbox.AbstractTool
arguments, internalFrame, MENU_EXECUTE, MENU_EXECUTE_PRINT, MENU_EXECUTE_PRINT_SILENT, MENU_EXECUTE_SHOW, menuoptions, versionsarray
-
-
Constructor Summary
Constructors Constructor Description WatermarkerTool()
This tool lets you add a text watermark to all pages of a document.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createFrame()
Creates the internal frame.void
execute()
Executes the tool (in most cases this generates a PDF file).protected java.io.File
getDestPathPDF()
Gets the PDF file that should be generated (or null if the output isn't a PDF file).static void
main(java.lang.String[] args)
This methods helps you running this tool as a standalone application.void
valueHasChanged(AbstractArgument arg)
Indicates that the value of an argument has changed.-
Methods inherited from class com.lowagie.toolbox.AbstractTool
actionPerformed, addVersion, getArguments, getInternalFrame, getMenubar, getUsage, getValue, setArguments, setInternalFrame, setMainArguments, setMenubar
-
-
-
-
Field Detail
-
destfile
FileArgument destfile
-
-
Method Detail
-
main
public static void main(java.lang.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 #FF000000
"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
(Optional) "#FF0000" is the color (in hex format like #nnnnnn or 0xnnnnnn), #000000 (black) by default
Call it from within other Java code:
Watermarker.main(new String[]{"input.pdf","Draft","230","0.2","output.pdf","#FF000000"});
- Parameters:
args
- the srcfile, watermark text and destfile
-
createFrame
protected void createFrame()
Creates the internal frame.- Specified by:
createFrame
in classAbstractTool
-
execute
public void execute()
Executes the tool (in most cases this generates a PDF file).- Specified by:
execute
in classAbstractTool
-
getDestPathPDF
protected java.io.File getDestPathPDF() throws java.lang.InstantiationException
Gets the PDF file that should be generated (or null if the output isn't a PDF file).- Specified by:
getDestPathPDF
in classAbstractTool
- Returns:
- the PDF file that should be generated
- Throws:
java.lang.InstantiationException
- on error
-
valueHasChanged
public void valueHasChanged(AbstractArgument arg)
Indicates that the value of an argument has changed.- Specified by:
valueHasChanged
in classAbstractTool
- Parameters:
arg
- the argument that has changed
-
-