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 stamp:

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

Stamp are shown in a table structure.

Id

Name

Descripcion

Text

Script

Color

Users

Active

Create new stamp based on text

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

Fields description:

FieldDescription

Name

Stamp name.

Description

Stamp description.

Text

The text to be shown in stamp.

Script

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

List of variables what can be used directly:

VariableDescription

document

Document object of the document node.

For more information see 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 file of the font must be copied into the $TOMCAT_HOME/lib folder.

Layer

Stamped image position.

Available values:

  • Under content.
  • Over content.

Opacity

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

An Opacity equals to 0 means a transparent text or image and you won't see it. Set to 0.5 to see an semi-transparent text or set to 1 to be opaque.

Also play with layer to stamp over or below the default text layer.

Size

Text size.

Align

Text align.

Available values:

  • Left.
  • Center.
  • Right.

Rotation

Text rotation. The range of values allowed are 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 Expr. X and Expr. Y input fields you can put more than a simple number. Currently the following macros are defined:

  • PAGE_WIDTH
  • PAGE_HEIGHT
  • PAGE_CENTER
  • PAGE_MIDDLE

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

Expr. X

PAGE_CENTER

Expr. Y

PAGE_MIDDLE

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

Create new stamp based on image

Fields description:

FieldDescription

Name

Stamp name.

Description

Stamp description.

Image

The image to be added into the document.

Script

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

List of variables what can be used directly:

VariableDescription

document

Document object of the document node.

For more information see 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

Stamped image position.

Available values:

  • Under content.
  • Over content.

Opacity

The text opacity. The range of values allowed are 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 the users.

Users

List of users who can use the stamp.

In Expr. X and Expr. Y input fields you can put 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 in 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 the form.
  • Click on Create button.

Edit stamp

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

Delete stamp

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

Test stamp

  • Click on  icon.

Staps what use scripting with variable document can not be tested from administration.