Chapter 3. Administration

Table of Contents

1. Print setup
1.1. Input variables
1.2. Output variables
1.3. Generic template for label generation with itext

There are several administration tasks:

1. Print setup

There is defined javascript code to generate box labels. Script code using several input variables to affect generated label. Box label content are stored to predifined output variable.

1.1. Input variables

Following variables are set up before javascript code is executed.

  1. label1, label2, label3, label4

  2. box

1.1.1. label1,..,label4

Boolean variables determining which plate will be generated. Values are set from html page just before calling javascript for label generation.

1.1.2. box

Object containing box attributes.

Table 3.1. Box attributes

MethodTypeDescription
getBoxNumber()StringNumber of box
getEntity()StringEntity
getGroup()StringGroup
getType()StringType
getLifeTime()StringLifetime of box in years
getNote()StringNote describing box content.
getCreationDate()StringDate when box was created.
getDiscardDate()StringDate when box will be discarded.
getDocumentNumberFrom()StringFirst (lowest) document number in box.
getDocumentNumberTo()StringLast (highest) document number in box.
getCreationTime()DateDate when box was created.
getDiscardTime()DateDate when box will be discarded.
getAgency()StringName of agency.

1.2. Output variables

Label content has to be stored to variable output. Variable output has following methods:

Table 3.2. Output variable methods.

MethodRet
OutputStream getData()Get OutputStream to write content to.
void setMimetype(String mimetype)Set mimetype of content.

1.3. Generic template for label generation with itext

Generic template for genration of label in pdf format with itext library.

importPackage(com.itextpdf.text) 
importPackage(com.itextpdf.text.pdf)
importPackage(java.io)
importPackage(java.util)

function createDocument(document,writer) {
  // create content here, use variables box, label1, label2, label3, label4 here 
}

var document = new Document(PageSize.A4.rotate());
var writer = PdfWriter.getInstance(document,output.getData());
document.open();
createDocument();
document.close();
output.setMimetype('application/pdf');