Stamp

Stamp feature helps you to insert an image into a document.

This option is hidden when Stamp extension is not enabled. Read about it at Enable extensions.

More information at Stamp extension.

You can set three types of stamps:

  • Based on images.
  • Based on text.
  • Based on barcodes.
  • To manage text stamps click on the top menu   Stamp button and then click on the submenu Text Stamp.
  • To manage image stamps click on the top menu   Stamp button and then click on the submenu Image Stamp.
  • To manage barcode stamps click on the top menu   Stamp button and then click on the submenu Barcode Stamp.

Stamps are shown in a table structure.

Id

Name

Description

Text

Script

Color

Users

Active

Create new stamp based on text

When using a stamp based on text, the text is converted to an image and then stamped into a document.

Field descriptions:

FieldDescription

Name

Stamp name.

Description

Stamp description.

Text

The text to be shown on the stamp.

Script

When set, the result of the script will be the stamped text.

List of variables that can be used directly:

VariableDescription

document

Document object of the document node.

For more information see the com.openkm.bean.Document class at API description.

Sample:

import java.util;

String value = "";
value = document.getActualVersion().getName();
value += "-" + String.valueOf(new Date());

return value;

Sample:

import org.springframework.web.context.*;
import com.openkm.util.*;
import com.openkm.api.*;

WebApplicationContext cc = (WebApplicationContext) ContextWrapper.getContext();
OKMPropertyGroup okmPrpGrp = cc.getBean(OKMPropertyGroup.class);
String prpGrpName = "okg:sample";

if (okmPrpGrp.hasGroup(null, document.getUuid(), prpGrpName)) {
  Map props = okmPrpGrp.getProperties(null, document.getUuid(), prpGrpName);
  return "Number: " + props.get("okp:sample.number");
} else {
  return "No property group assigned: " + prpGrpName;
}

Font

unicode.ttf

The font file must be copied into the $TOMCAT_HOME/lib folder.

Layer

Position of the stamped image.

Available values:

  • Under content.
  • Over content.

Opacity

The text opacity. The range of allowed values is from 0 to 1.

An Opacity equal to 0 means the text or image is transparent and you won't see it. Set it to 0.5 to see semi-transparent text or to 1 to be opaque.

Also try changing the layer to stamp over or below the default text layer.

Size

Text size.

Align

Text alignment.

Available values:

  • Left.
  • Center.
  • Right.

Rotation

Text rotation. The range of allowed values is from 0 to 360.

Colour

The text colour.

Expr. X

Expression to set the position in X coordinates.

Expr. Y

Expression to set the position in Y coordinates.

Active

When enabled the stamp will be available to the users.

Users

List of users who can use the stamp.

In the Expr. X and Expr. Y input fields, you can enter more than a simple number. Currently the following macros are defined:

  • PAGE_WIDTH
  • PAGE_HEIGHT
  • PAGE_CENTER
  • PAGE_MIDDLE

So to center a stamp on the page you can use:

Expr. X

PAGE_CENTER

Expr. Y

PAGE_MIDDLE

  • Click on  Create new Stamp icon.
  • Fill in the form.
  • Click on the Create button.

Create new stamp based on image

Field descriptions:

FieldDescription

Name

Stamp name.

Description

Stamp description.

Image

The image to be added into the document.

Script

When set, the result of the script will be the stamped text.

List of variables that can be used directly:

VariableDescription

document

Document object of the document node.

For more information see the com.openkm.bean.Document class at API description.

Sample:

import java.util;

String value = "";
value = document.getActualVersion().getName();
value += "-" + String.valueOf(new Date());

return value;

Layer

Position of the stamped image.

Available values:

  • Under content.
  • Over content.

Opacity

The image opacity. The range of allowed values is from 0 to 1.

Expr. X

Expression to set the position in X coordinates.

Expr. Y

Expression to set the position in Y coordinates.

Active

When enabled, the stamp will be available to users.

Users

List of users who can use the stamp.

In the Expr. X and Expr. Y input fields, you can enter more than a simple number. Currently the following macros are defined:

  • IMAGE_WIDTH
  • IMAGE_HEIGHT
  • PAGE_WIDTH
  • PAGE_HEIGHT
  • PAGE_CENTER
  • PAGE_MIDDLE

So to center a stamp on the page you can use:

Expr. X

PAGE_CENTER - IMAGE_WIDTH / 2

Expr. Y

PAGE_MIDDLE - IMAGE_HEIGHT / 2

  • Click on  Create new Stamp icon.
  • Fill in the form.
  • Click on the Create button.

Edit stamp

  • Click on  Edit icon.
  • Modify the form.
  • Click on the Edit button.

Delete stamp

  • Click on  Delete icon.
  • Click on the Delete button.

Test stamp

  • Click on  the icon.

Stamps that use scripting with the document variable cannot be tested from the administration interface.