Dynamically load custom Image Stamps via Javascript API
The list of available image stamps configured in config.js
and can be modified dynamically via a Javascript API. These stamps are loaded with a provided URI, rather than by assuming a stamp’s presence and naming convention in the Resources
directory.
Important! The
web.xml
initial parameter customImageRubberStamps has been deprecated in favor of the newconfig.js
initialStamps list and its related stamp Javascript API.
The configuration item initialStamps
in config.js
holds a list of image stamp objects. An image stamp object consists of a display name for a stamp, the stampTitle
attribute, and the URI of the stamp image in the url attribute. Optional attributes width and height allow for default dimensions other than the stamp image’s native dimensions.
These stamp images may be stored in any accessible location, whether that be locally in the resources/stamps directory within PrizmDoc® for Java, or elsewhere on the web or your organization’s filesystem.
Several of the functions below take image stamp objects. An image stamp object has four attributes: url
, stampTitle
, width
, and height
. Only url and stampTitle are required. An example object, from config.example.js
, would look like:
{
stampTitle: "Approved",
url: "./resources/stamps/Approved.png", width: 535,
height: 293
}
Functions that accept image stamp objects include:
clearImageStamps
will remove all the stamp options from the Image Rubber Stamp dropdown list in the toolbar.createImageStamp
will add a single image stamp to the Image Rubber Stamp dropdown on the toolbar.url {string}
The URI of the stamp’s image.stampTitle {string}
The displayed title of the stamp. This will appear in the list in the toolbar.- o
ptions {object}
Dimension options for the stamp. The attributes of this object are listed below asoptions.attribute
. options.width {number}
The width of the stamp image. If not provided, the native width of the stamp image will be used.options.height {number}
The height of the stamp image. If not provided, the native height of the stamp image will be used.createImageStampArray
will add a whole array of image stamps to the viewer. The provided stamps will append to the existing list of stamps. A stamp object has mandatory URL and title properties, and optional width and height properties.stampList {array of image stamps}
An array of stamp objects, that requireurl
andstampTitle
properties to be valid, as described above.createImageStampArrayFromFunction
will initialize the viewer’s list of image stamps. This takes a callback function as a parameter, and calls that function to get the actual list of image stamps that will be used in the viewer.fn {function}
This function is called with no parameters. It is expected to return an array of image stamp objects, as described above. The array returned by this function will be used to fill the stamp list on the toolbar.
Have questions, corrections, or concerns about this topic? Please let us know!