Class RubberStampWithImage
- java.lang.Object
-
- org.apache.pdfbox.examples.pdmodel.RubberStampWithImage
-
public class RubberStampWithImage extends java.lang.ObjectThis is an example on how to add a rubber stamp annotation with an image to pages of a PDF document. To add a normal image, use the AddImageToPDF.java example.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCONCATENATE_MATRIXprivate static java.text.NumberFormatFORMATDECIMALprivate static java.lang.StringRESTORE_GRAPHICS_STATEprivate static java.lang.StringSAVE_GRAPHICS_STATEprivate static java.lang.StringSPACEprivate static java.lang.StringXOBJECT_DO
-
Constructor Summary
Constructors Constructor Description RubberStampWithImage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappendRawCommands(java.io.OutputStream os, java.lang.String commands)voiddoIt(java.lang.String[] args)Add a rubber stamp with an jpg image to every page of the given document.private voiddrawXObject(PDImageXObject xobject, PDResources resources, java.io.OutputStream os, float x, float y, float width, float height)static voidmain(java.lang.String[] args)This creates an instance of RubberStampWithImage.private voidusage()This will print the usage for this example.
-
-
-
Field Detail
-
SAVE_GRAPHICS_STATE
private static final java.lang.String SAVE_GRAPHICS_STATE
- See Also:
- Constant Field Values
-
RESTORE_GRAPHICS_STATE
private static final java.lang.String RESTORE_GRAPHICS_STATE
- See Also:
- Constant Field Values
-
CONCATENATE_MATRIX
private static final java.lang.String CONCATENATE_MATRIX
- See Also:
- Constant Field Values
-
XOBJECT_DO
private static final java.lang.String XOBJECT_DO
- See Also:
- Constant Field Values
-
SPACE
private static final java.lang.String SPACE
- See Also:
- Constant Field Values
-
FORMATDECIMAL
private static final java.text.NumberFormat FORMATDECIMAL
-
-
Method Detail
-
doIt
public void doIt(java.lang.String[] args) throws java.io.IOExceptionAdd a rubber stamp with an jpg image to every page of the given document.- Parameters:
args- the command line arguments- Throws:
java.io.IOException- an exception is thrown if something went wrong
-
drawXObject
private void drawXObject(PDImageXObject xobject, PDResources resources, java.io.OutputStream os, float x, float y, float width, float height) throws java.io.IOException
- Throws:
java.io.IOException
-
appendRawCommands
private void appendRawCommands(java.io.OutputStream os, java.lang.String commands) throws java.io.IOException- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionThis creates an instance of RubberStampWithImage.- Parameters:
args- The command line arguments.- Throws:
java.io.IOException- If there is an error parsing the document.
-
usage
private void usage()
This will print the usage for this example.
-
-