← Return to the list of hooks Info |
---|
If you have a problem understanding how the hook works, check: Hook's mechanism |
Panel |
---|
| Available from version: 1.0.0
|
Panel |
---|
| Hook places a watermark on the document as it is displayed. This hook is implemented based on the definition of the ReadFileHookAdapter system hook, which allows to change the binary stream of the displayed document from archive or in preview in the process. Configuration of the watermark insert hook is defined in JSON format as a list and is managed by the PCM (Plugin Configuration Manager). A watermark is placed on every page of the document and accepts only PDF format. |
Panel |
---|
| Code Block |
---|
| - documentClassId
- watermark
- type
- text
- alignment
- anchor
- positionX%
- positionY%
- opacity
- clockwiseAngle
- watermarkBarcode
- format
- codeWidth
- codeHeight
- textUnderBarcode
- rotationMechanism
- watermarkText
- fontSize
- fontType
- fontColor
- encoding
- backgroundColor
- permissions
- groups
-errorHandling
-removePDFSecurity |
Warning |
---|
Plugin version 1.0.0 is incompatible with newer versions. Installing plugin version 1.0.1 or later will run the Upgrader, which will update the JSON configuration file to match plugin version 1.0.1. |
|
Panel |
---|
title | Configuration parameters |
---|
| Parameter name in JSON configuration | From version | Description | Paremeter type | Comments and restrictions |
---|
documentClassId* | 1.0.0 | The document class id indicates for which documents the watermark insertion parameters are to be considered. | Integer | | type* (watermark) | 1.0.0 | Specifies what type of watermark is. | Text | Value | Description |
---|
BARCODE | Encodes the value of the text parameter into a barcode with the specified format defined in the format parameter. The watermark on the document is a barcode. | TEXT | The value of the text parameter is applied to the document as an explicit, unencoded watermark. |
| text* (watermark) | 1.0.0 | Takes the text value that is used to create the watermark. In order to use document index values, the index id should be enclosed in curly braces {}. It is possible to use more than one index value in a parameter. Each subsequent index must be followed by curly braces. Example: Case number: "{8}, Registration Date {9}" Watermark text -> Case number: 433589, Registration Date: 13-02-2021
It is also possible to use special keywords that return information about the user, process id and activity id. All available values are listed in the next column. Example: "Username: {USER_NAME}, Date: {CURRENT_DATE}" Watermark text -> "Username: admin, Date: 2022-10-21"
| Text | Warning |
---|
Any typed index ids in the text string must exist in the document class specified by the documentClassId parameter. If the document being viewed does not contain an index value (it is empty) whose id is given in curly braces in this parameter, the id will be replaced with the empty string "". |
Keyword | Description |
---|
{CURRENT_DATE} | Current date in yyyy-MM-dd format. | {CURRENT_DATE_AND_TIME} | Current date and time in yyyy-MM-dd HH-mm-ss format. | {PROCESS_ID} | Process id. | {ACTIVITY_ID} | Activity id. | {USER_NAME} | User name. | {USER_EMAIL} | User email. | {USER_FULL_NAME} | User full name that consists of first and last name. | {USER_FIRST_NAME} | User first name. | {USER_LAST_NAME} | User last name. | {USER_NUMBER} | User number. |
| alignment* (watermark) | 1.0.0 | Specifies relative to which of the four corners of the document page the position of the watermark will be calculated based on the positionX% and positionY% parameters. More information... | Text | Pay attention to the corresponding values of the positionX% and positionY% parameters, because depending on the value of the alignment, anchor parameter, and the size of the watermark, the watermark may extend beyond the document page, i.e. be partially or completely invisible. Available values |
---|
TOP_LEFT | TOP_RIGHT | BOTTOM_LEFT | BOTTOM_RIGHT |
| anchor* (watermark) | 1.0.0 | Specifies a point in the circumference or in the center of the watermark from which the position of the watermark is determined based on the values of parameters positionX% and positionY%. More information... | Text | Available values |
---|
TOP_LEFT | TOP_MIDDLE | TOP_RIGHT | CENTER_LEFT | CENTER_MIDDLE | CENTER_RIGHT | BOTTOM_LEFT | BOTTOM_MIDDLE | BOTTOM_RIGHT |
| positionX%* (watermark) | 1.0.0 | Indicates the X (horizontal) position of the watermark in percent relative to the document page dimensions. The position is set based on the selected page corner in the alignment parameter. | Integer | Value between 0 and 100. | positionY%* (watermark) | 1.0.0 | Indicates the Y (vertical) position of the watermark in percent relative to the document page dimensions. The position is set based on the selected page corner in the alignment parameter. | Integer | Value between 0 and 100. | opacity* (watermark) | 1.0.0 | Specifies the degree of visibility of the inserted watermark. | Float | The element is fully transparent (invisible). The item is partially transparent. The element is fully opaque (uniform). | clockwiseAngle* (watermark) | 1.0.0 | Watermark rotation. | Float | | format* (watermark.watermarkBarcode) | 1.0.0 | Specifies the barcode format.
More information... | Text | Available values |
---|
AZTEC | CODABAR | CODE_39 | CODE_93 | CODE_128 | DATA_MATRIX | EAN_8 | EAN_13 | ITF | PDF_417 | QR_CODE | UPC_A | UPC_E |
| codeWidth* (watermark.watermarkBarcode) | 1.0.0 | Defines the width of the barcode in pixels. | Integer | Specifies the minimum width of the barcode. In case the value to be encoded from the text parameter turns out to be too long, the width will be increased. | codeHeight* (watermark.watermarkBarcode) | 1.0.0 | Defines the height of the barcode in pixels. | Integer | | textUnderBarcode* (watermark.watermarkBarcode) | 1.0.1 | Specifies whether to display the text encoded in the barcode below this barcode. | Boolean | The text has a fixed font size of 11 and black color. | rotationMechanism (watermark.watermarkBarcode) | 1.0.8 | Specifies how a barcode watermark rotation should work. Method 1 - (obsolete) rotation is based on the basic functions of the library. The rotation for the barcode watermark is counterclockwise. Method 2 (recommended) - rotation takes place relative to the watermark point specified in the anchor property. The rotation is clockwise for the barcode watermark. The parameter is optional. By default, METHOD_1 is used. | Text | Available values |
---|
METHOD_1 | METHOD_2 |
| size* (watermark.watermarkText) | 1.0.0 | Text size. | Float | | fontType* (watermark.watermarkText) | 1.0.0 | Text font type. | Text | Value | Description |
---|
COURIER | Courier | COURIER_BOLD | Courier Bold | COURIER_OBLIQUE | Courier Oblique | COURIER_BOLDOBLIQUE | Courier Bold Oblique | HELVETICA | Helvetica | HELVETICA_BOLD | Helvetica Bold | HELVETICA_OBLIQUE | Helvetica Oblique | HELVETICA_BOLDOBLIQUE | Helvetica Bold Oblique | SYMBOL | Symbol | TIMES_ROMAN | Times Roman | TIMES_BOLD | Times Bold | TIMES_ITALIC | Times Italic | TIMES_BOLDITALIC | Times Bold Italic | ZAPFDINGBATS | Zapf Dingbats |
| fontColor* (watermark.watermarkText) rotation | 1.0.0 | Rotacja znaku wodnegoColor of the text. | Zmiennoprzecinkowy | Wartość z przedziału 0.0 - 360.0. | permissions groups | 1.0.0 | Uprawnienia określające dla jakich zalogowanych użytkowników w systemie przy próbie otwarcia dokumentu zostanie uruchomiony hook. Wskazuje na grupy użytkowników systemowych. | Tablica wartości tekstowych | Parametr opcjonalny, gdy nie jest uzupełniony to znak wodny widzą wszyscy. |
|
Panel |
---|
title | Przykładowa konfiguracja |
---|
| Image Removed
Info |
---|
title | Przykładowa konfiguracja JSON |
---|
| [ { "documentClass": "Dokumenty prawne", "watermark": { "type": "TEXT", "text": "Numer sprawy: {Numer sprawy}, Data rejestracji: {Data rejestracji}", "positionX%": 5, "positionY%": 5, "opacity": 0.7, "alignment": "BOTTOM_LEFT", "watermarkText":{ "size": 15, "color": "LIGHT_GRAY", "fontType": "HELVETICA", "rotation": 0 } }, "permissions": { "groups": ["Users", "Administrators"] } }, { "documentClass": "Dokumenty prawne", "watermark": { "type": "BARCODE", "text": "{Numer sprawy}", "positionX%": 80, "positionY%": 10, "opacity": 0.5, "alignment": "BOTTOM_LEFT", "watermarkBarcode":{ "format": "CODE_128", "codeWidth": 50, "codeHeight": 15 } }, "permissions": { "groups": ["Users", "Administrators"] } } ] |
|
Text | Value | Description |
---|
WHITE | White | LIGHT_GRAY | Light gray | GRAY | Gray | DARK_GRAY | Dark gray | BLACK | Black | RED | Red | PINK | Pink | ORANGE | Orange | YELLOW | Yellow | GREEN | Green | MAGENTA | Magenta | CYAN | Cyan | BLUE | Blue |
| encoding* (watermark.watermarkText) | 1.0.0 | Character encoding standard. More information... | Text | Available values |
---|
CP1250 | CP1252 | CP1257 | MACROMAN |
| backgroundColor (watermark.watermarkText) | 1.0.1 | Text background color. | | The parameter is optional. If it is not defined, the background for the watermark in the form of text will not be used. Value | Description |
---|
WHITE | White | LIGHT_GRAY | Light gray | GRAY | Gray | DARK_GRAY | Dark gray | BLACK | Black | RED | Red | PINK | Pink | ORANGE | Orange | YELLOW | Yellow | GREEN | Green | MAGENTA | Magenta | CYAN | Cyan | BLUE | Blue |
| errorHandling* | 1.0.1 | Error handling. Defines how the document preview window should behave in the event of any error, e.g. incorrect characters in the text used to encode the barcode for a specific barcode format. | Text | Value | Description |
---|
BLOCK | An HTML page is displayed with the error message. It is not possible to download the original (no watermark) document. | DISPLAY_ORIGINAL | The original document is displayed and available for download. |
Warning |
---|
The value of this parameter is taken into account after JSON deserialization (after entering the correct names and values of JSON configuration parameters in PCM), hence if an error occurs during the deserialization stage, the default BLOCK error handling will be used. |
| groups (permissions) | 1.0.0 | Permissions defining for which users logged in to the system the hook will be run when trying to open a document. | Array of text values | Optional parameter, when is not filled, everyone can see the watermark. | removePDFSecurity | 1.0.2 | Removes the file's password that protects it from being modified. The resulting file has no security compared to its original version. The parameter does not take into account the removal of the file password that was used to prevent the file from being opened. | Boolean | Optional, when undefined, defaults to false for backward compatibility. |
Parameter*- field is required |
Panel |
---|
title | Configuration example |
---|
| Image Added
Code Block |
---|
language | js |
---|
linenumbers | true |
---|
| [
{
"documentClassId": 5,
"watermark": {
"type": "TEXT",
"text": "Case number: {10}, Registration date: {11}",
"alignment": "TOP_LEFT",
"anchor": "BOTTOM_LEFT",
"positionX%": 5,
"positionY%": 5,
"opacity": 0.7,
"clockwiseAngle": 0,
"watermarkText":{
"fontSize": 15,
"fontType": "HELVETICA",
"fontColor": "WHITE",
"encoding": "CP1252",
"backgroundColor": "BLACK"
}
},
"permissions": {
"groups": ["Users", "Administrators"]
},
"errorHandling": "BLOCK"
},
{
"documentClassId": 5,
"watermark": {
"type": "BARCODE",
"text": "{10}",
"alignment": "TOP_LEFT",
"anchor": "BOTTOM_LEFT",
"positionX%": 80,
"positionY%": 10,
"opacity": 0.5,
"clockwiseAngle": 0,
"watermarkBarcode":{
"format": "CODE_128",
"codeWidth": 50,
"codeHeight": 15,
"textUnderBarcode": false,
"rotationMechanism": "METHOD_1"
}
},
"permissions": {
"groups": ["Users", "Administrators"]
},
"errorHandling": "BLOCK",
"removePDFSecurity": true
}
] |
|
Panel |
---|
| Expand |
---|
| Code Block |
---|
language | js |
---|
title | JSON configuration |
---|
linenumbers | true |
---|
| [
{
"documentClassId": 5,
"watermark": {
"type": "TEXT",
"text": "Case number: {10}, Registration date: {11}",
"alignment": "TOP_LEFT",
"anchor": "BOTTOM_LEFT",
"positionX%": 5,
"positionY%": 5,
"opacity": 0.7,
"clockwiseAngle": 0,
"watermarkText":{
"fontSize": 15,
"fontType": "HELVETICA",
"fontColor": "LIGHT_GRAY",
"encoding": "CP1252",
}
},
"permissions": {
"groups": ["Users", "Administrators"]
},
"errorHandling": "BLOCK"
},
{
"documentClassId": 5,
"watermark": {
"type": "BARCODE",
"text": "{10}",
"alignment": "TOP_LEFT",
"anchor": "BOTTOM_LEFT",
"positionX%": 80,
"positionY%": 10,
"opacity": 0.5,
"clockwiseAngle": 0,
"watermarkBarcode":{
"format": "CODE_128",
"codeWidth": 50,
"codeHeight": 15,
"textUnderBarcode": false
}
},
"permissions": {
"groups": ["Users", "Administrators"]
},
"errorHandling": "BLOCK"
}
] |
Original document: Image Added
After opening: Image Added |
Expand |
---|
| Code Block |
---|
language | js |
---|
title | JSON configuration |
---|
linenumbers | true |
---|
| [
{
"documentClassId": 5,
"watermark": {
"type": "TEXT",
"text": "Case number: {10}, Registration date: {11}",
"alignment": "TOP_LEFT",
"anchor": "BOTTOM_LEFT",
"positionX%": 5,
"positionY%": 5,
"opacity": 0.7,
"clockwiseAngle": 0,
"watermarkText":{
"fontSize": 15,
"fontType": "HELVETICA",
"fontColor": "WHITE",
"encoding": "CP1252",
"backgroundColor": "BLACK"
}
},
"permissions": {
"groups": ["Users", "Administrators"]
},
"errorHandling": "BLOCK"
},
{
"documentClassId": 5,
"watermark": {
"type": "BARCODE",
"text": "{10}",
"alignment": "TOP_LEFT",
"anchor": "BOTTOM_LEFT",
"positionX%": 80,
"positionY%": 10,
"opacity": 0.9,
"clockwiseAngle": 0,
"watermarkBarcode":{
"format": "CODE_128",
"codeWidth": 50,
"codeHeight": 15,
"textUnderBarcode": true
}
},
"permissions": {
"groups": ["Users", "Administrators"]
},
"errorHandling": "BLOCK",
"removePDFSecurity": true
}
] |
Original document: Image Added
After opening: Image Added
|
|
|