With VirtualViewer’s image stamp annotations, users can apply a set of small, administrator-defined images to a document. The available images were defined in web.xml or web.config, and provided in VirtualViewer’s resources directory. This method did not allow dynamic adjustment to the list of stamps, and could cause problems on different servers.

Now, the initial list of available image stamps are configured in config.js, and can be modified dynamically by Javascript API. Further, stamps are loaded with a provided URI, rather than assuming a stamp’s presence and naming convention in the Resources directory.

New API

Several of the following API 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
}
  • 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.
    • options {object} Dimension options for the stamp. The attributes of this object are listed below as options.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 require “url” and “stampTitle” 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.

Configuration

The web.xml initial parameter customImageRubberStamps has been deprecated in favor of the new config.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.

Due to the URI provided to the stamp object, stamp images may be stored in any accessible location. That may still be locally in the resources/stamps directory within VirtualViewer.