Top Description Fields Constructors Methods
org.apache.pdfbox.examples.pdmodel

public Class RubberStampWithImage

extends Object
Class Inheritance
Imports
java.io.File, .IOException, .OutputStream, java.nio.charset.StandardCharsets, java.text.NumberFormat, java.util.List, .Locale, org.apache.pdfbox.Loader, org.apache.pdfbox.cos.COSDictionary, .COSName, org.apache.pdfbox.pdmodel.PDDocument, .PDPage, .PDResources, org.apache.pdfbox.pdmodel.common.PDRectangle, org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject, org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject, org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation, .PDAnnotationRubberStamp, .PDAppearanceDictionary, .PDAppearanceStream

This 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

Modifier and TypeField and Description
private static final String
private static final NumberFormat
private static final String
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
public void
doIt(String[]
the command line arguments
args
)

Add a rubber stamp with an jpg image to every page of the given document.

private void
drawXObject(PDImageXObject xobject, PDResources resources, OutputStream os, float x, float y, float width, float height)

public static void
main(String[]
The command line arguments.
args
)

This creates an instance of RubberStampWithImage.

private void
usage()

This will print the usage for this example.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONCATENATE_MATRIXback to summary
private static final String CONCATENATE_MATRIX
FORMATDECIMALback to summary
private static final NumberFormat FORMATDECIMAL
RESTORE_GRAPHICS_STATEback to summary
private static final String RESTORE_GRAPHICS_STATE
SAVE_GRAPHICS_STATEback to summary
private static final String SAVE_GRAPHICS_STATE
SPACEback to summary
private static final String SPACE
XOBJECT_DOback to summary
private static final String XOBJECT_DO

Constructor Detail

RubberStampWithImageback to summary
public RubberStampWithImage()

Method Detail

appendRawCommandsback to summary
private void appendRawCommands(OutputStream os, String commands) throws IOException
doItback to summary
public void doIt(String[] args) throws IOException

Add a rubber stamp with an jpg image to every page of the given document.

Parameters
args:String[]

the command line arguments

Exceptions
IOException:
an exception is thrown if something went wrong
drawXObjectback to summary
private void drawXObject(PDImageXObject xobject, PDResources resources, OutputStream os, float x, float y, float width, float height) throws IOException
mainback to summary
public static void main(String[] args) throws IOException

This creates an instance of RubberStampWithImage.

Parameters
args:String[]

The command line arguments.

Exceptions
IOException:
If there is an error parsing the document.
usageback to summary
private void usage()

This will print the usage for this example.