← Powrót do listy dostępnych hook'ów

Jeśli masz problem ze zrozumieniem jak działają hook'i, sprawdź opis: Mechanizm hook'ów

Dostępny od: 1.0.0

Hook pełni funkcję umieszczania znaku wodnego na dokumencie w czasie jego wyświetlania. Jest on zaimplementowany na podstawie definicji hook'a systemowego ReadFileHookAdapter, który umożliwia zmianę strumienia binarnego wyświetlanego dokumentu z archiwum lub w podglądzie w procesie. Konfiguracja hook'a wstawiającego znak wodny jest określana w formacie JSON pod postacią listy i zarządzana jest przez wtyczkę PCM (Plugin Configuration Manager). Znak wodny jest umieszczany na każdej stronie dokumentu.

Nazwa parametru w konfiguracji JSONOd wersjiOpisTyp parametruUwagi i ograniczenia
documentClassId*1.0.0Identyfikator klasy dokumentów wskazuje dla których dokumentów ma być uruchamiany mechanizm wstawiania znaku wodnego.Całkowity

 

watermark

type*

1.0.0Określa typ znaku wodnego.
Tekstowy
WartośćZnaczenie
BARCODEkoduje wartość parametru text do postaci kodu kreskowego o określonym formacie zdefiniowanym w parametrze format. Znak wodny umieszczany na dokumencie jest kodem kreskowym.
TEXTWartość parametru text jest nanoszona na dokument jako znak wodny w formie jawnej, niezakodowanej.

watermark

text*

1.0.0

Przyjmuje wartość tekstową, która jest wykorzystywana do utworzenia znaku wodnego. W celu skorzystania z wartości indeksów dokumentu należy umieścić identyfikator indeksu w nawiasach klamrowych {}. Istnieje możliwość wykorzystania więcej niż jednej wartości indeksu w parametrze. Każdy kolejny indeks musi być opatrzony nawiasami klamrowymi.

Przykład.

"Numer sprawy: {8}, Data rejestracji: {9}"

Tekst znaku wodnego ->

Numer sprawy: 433589, Data rejestracji: 13-02-2021

Tekstowy

Wszystkie wpisane identyfikatory indeksów w ciągu tekstowym muszą istnieć w klasie dokumentów podanej w parametrze documentClass. Jeśli przeglądany dokument nie zawiera wartości indeksu (jest pusty), którego identyfikator został podany w tym parametrze w nawiasach klamrowych, to identyfikator zostanie zastąpiony pustym łańcuchem znaków "".

 

 

 

 

 

watermark

positionX%*

1.0.0Wskazuje pozycję procentową X (w poziomie) znaku wodnego względem wymiarów strony dokumentu.CałkowityPozycja liczona od lewej krawędzi (0%) do prawej krawędzi strony (100%).

watermark

positionY%*

1.0.0Wskazuje pozycję procentową Y (w pionie) znaku wodnego względem wymiarów strony dokumentu.CałkowityPozycja liczona od górnej krawędzi (0%) do dolnej krawędzi strony (100%).

watermark

opacity*

1.0.0Określa przezroczystość wstawianego znaku wodnego.ZmiennoprzecinkowyWartość z przedziału 0.0 - 1.0.

watermark

alignment*

1.0.0

Określa względem którego z czterech rogów strony dokumentu obliczona zostanie pozycja znaku wodnego na podstawie wartości parametrów positionX% oraz positionY%.

Tekstowy
WartośćZnaczenie
TOP_LEFT

Pozycja znaku wodnego względem górnego lewego rogu.

TOP_RIGHT

Pozycja znaku wodnego względem górnego prawego rogu.

BOTTOM_LEFT

Pozycja znaku wodnego względem dolnego lewego rogu.

BOTTOM_RIGHT

Pozycja znaku wodnego względem dolnego prawego rogu.

watermark

anchor*

1.0.0Określa pozycję znaku wodnego względem odpowiedniego rogu znaku wodnego.Tekstowy
WartośćZnaczenie
BOTTOM_LEFT

Pozycja znaku wodnego względem lewego dolnego rogu znaku wodnego.

 

watermark

watermarkBarcode

format

1.0.0Określa standard kodów kreskowych w postaci jednowymiarowej (zapis informacji w jednej linii, w formie kresek).Tekstowy
WartośćZnaczenie
CODE_39

Jednowymiarowy kod kreskowy zawierający znaki alfanumeryczne o zmiennej długości, w którym występują paski o dwóch różnych szerokościach. Do kodowania CODE_39 używane są 43 znaki plus dodatkowe znaki, które są ogranicznikami i znakami start/stop. Znak start/stop zawsze występuje jako pierwszy i ostatni znak kodu i jest nim znak '*'. Ten format nie pozwala na zakodowanie małych liter.

Znak
Wartość
Znak
Wartość
Znak
Wartość
Znak
Wartość
0
0
B
11
M
22
X
33
1
1
C
12
N
23
Y
34
2
2
D
13
O
24
Z
35
3
3
E
14
P
25
-
36
4
4
F
15
Q
26
.
37
5
5
G
16
R
27
space
38
6
6
H
17
S
28
$
39
7
7
I
18
T
29
/
40
8
8
J
19
U
30
+
41
9
9
K
20
V
31
%
42
A
10
L
21
W
32
  

 

CODE_93

Jednowymiarowy kod kreskowy będący udoskonaleniem formatu CODE_39. Występują w nim paski o czterech różnych szerokościach. Podobnie jak swój pierwowzór przechowuje 43 znaki alfanumeryczne, ale dodatkowo posiada 4 znaki sterujące (($), (%), (/), (+)), które są używane do kodowania wszystkich 128 znaków ASCII (CODE_93 Extended). Kod przyjmuje wyłącznie wielkie litery, chyba że zostaną użyte znaki sterujące.

Znak
Wartość
Znak
Wartość
Znak
Wartość
Znak
Wartość
0
0
C
12
O
24
-
36
1
1
D
13
P
25
.
37
2
2
E
14
Q
26
space
38
3
3
F
15
R
27
$
39
4
4
G
16
S
28
/
40
5
5
H
17
T
29
+
41
6
6
I
18
U
30
%
42
7
7
J
19
V
31
($)
43
8
8
K
20
W
32
(%)
44
9
9
L
21
X
33
(/)
45
A
10
M
22
Y
34
(+)
46
B
11
N
23
Z
35
  

Code 93

 

CODE_128

Kod alfanumeryczny o zmiennej długości i wysokiej gęstości. Potrafi kodować znaki z całego zakresu ASCII.

watermark

watermarkBarcode

codeWidth

1.0.0Definiuje szerokość kodu kreskowego w pikselach.CałkowityParametr nie definiuje maksymalnej szerokości kodu kreskowego - w przypadku, gdy podstawiana wartość okaże się zbyt długa, szerokość automatycznie zostanie zwiększona.

watermark

watermarkBarcode

codeHeight

1.0.0Definiuje wysokość kodu kreskowego w pikselach.Całkowity 

watermark

watermarkText

size

1.0.0Rozmiar tekstu.Zmiennoprzecinkowy 

watermark

watermarkText

encoding

1.0.0Kodowanie znaków.Tekstowy
WartośćZnaczenie

CP1250

Strona kodowa służąca do reprezentacji tekstów w językach środkowoeuropejskich używających alfabetu łacińskiego, na przykład albańskim, chorwackim, czeskim, polskim, rumuńskim, słowackim, słoweńskim, węgierskim.
CP1252Strona kodowa służąca do reprezentacji tekstów w językach zachodnioeuropejskich.
CP1257Strona kodowa służąca do reprezentacji tekstów w językach estońskim, litewskim, czy łotewskim. Zestaw ten jest w znacznej części kompatybilny z ISO 8859-13, oraz nadaje się do kodowania języka polskiego.
MACROMANKodowanie znaków używane głównie w klasycznym systemie Mac OS do reprezentowania tekstu. Koduje 256 znaków, z których pierwsze 128 jest identyczne z ASCII, a pozostałe znaki obejmują symbole matematyczne, znaki diakrytyczne i dodatkowe znaki interpunkcyjne. Jest odpowiedni dla języka angielskiego i kilku innych języków zachodnich.

watermark

watermarkText

color

1.0.0Kolor tekstu.Tekstowy
WartośćZnaczenie
WHITEBiały
LIGHT_GRAYJasnoszary
GRAYSzary
DARK_GRAYCiemnoszary
BLACKCzarny
REDCzerwony
PINKRóżowy
ORANGEPomarańczowy
YELLOWŻółty
GREENZielony
MAGENTAMagenta
CYANCyjan
BLUENiebieski

watermark

watermarkText

fontType

1.0.0Rodzaj czcionki tekstu.Tekstowy
WartośćZnaczenie
COURIERCourier
COURIER_BOLDCourier Bold
COURIER_OBLIQUECourier Oblique
COURIER_BOLDOBLIQUECourier Bold Oblique
HELVETICAHelvetica
HELVETICA_BOLDHelvetica Bold
HELVETICA_OBLIQUEHelvetica Oblique
HELVETICA_BOLDOBLIQUEHelvetica Bold Oblique
SYMBOLSymbol
TIMES_ROMANTimes Roman
TIMES_BOLDTimes Bold
TIMES_ITALICTimes Italic
TIMES_BOLDITALICTimes Bold Italic
ZAPFDINGBATSZapf Dingbats

watermark

watermarkText

rotation

1.0.0Rotacja znaku wodnego.ZmiennoprzecinkowyWartość z przedziału 0.0 - 360.0.

permissions

groups

1.0.0Uprawnienia 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 tekstowychParametr opcjonalny, gdy nie jest uzupełniony to znak wodny widzą wszyscy.

[
  {
   "documentClassId": 4,
   "watermark": {
        "type": "TEXT",
        "text": "Numer sprawy: {8}, Data rejestracji: {9}",
        "positionX%": 5,
        "positionY%": 5,
        "opacity": 0.7,
        "alignment": "TOP_LEFT",
        "anchor": "BOTTOM_LEFT",
        "watermarkText":{
            "size": 15,
            "encoding": "CP1250",
            "color": "LIGHT_GRAY",
            "fontType": "HELVETICA",
            "rotation": 0
        }
    },
   "permissions": {
       "groups": ["Users", "Administrators"]  
    }
  },
  {
   "documentClassId": 4,
   "watermark": {
        "type": "BARCODE",
        "text": "{8}",
        "positionX%": 80,
        "positionY%": 10,
        "opacity": 0.5,
        "alignment": "TOP_LEFT",
        "anchor": "BOTTOM_LEFT",
        "watermarkBarcode":{
            "format": "CODE_128",       
            "codeWidth": 50,
            "codeHeight": 15
        }
    },
   "permissions": {
       "groups": ["Users", "Administrators"]  
    }
  }
]

Przykład działania dla powyższej konfiguracji JSON'a.

Oryginalny dokument:

 Po otwarciu:

1.0.0

  • Dodanie hook'a

← Return to the list of hooks

If you have a problem understanding how the hook works, check: Hook's mechanism

Available from version: 1.0.0

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.

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

 

watermark

type*

1.0.0Specifies what type of watermark is.Text
ValueMeaning
BARCODEEncodes 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.
TEXTThe value of the text parameter is applied to the document as an explicit, unencoded watermark.

watermark

text*

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

 

Text

Any typed index ids in the text string must exist in the document class specified by the documentClass 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 "".

watermark

positionX%*

1.0.0Indicates the X (horizontal) position of the watermark in percent relative to the document page dimensions.IntegerThe position is counted from the left edge (0%) to the right edge of the page (100%).

watermark

positionY%*

1.0.0Indicates the Y (vertical) position of the watermark in percent relative to the document page dimensions.IntegerThe position is counted from the top edge (0%) to the bottom edge of the page (100%).

watermark

opacity*

1.0.0Specifies the transparency of the inserted watermark on the pages of the document.FloatValue between 0.0 and 1.0.

watermark

alignment*

1.0.0Specifies 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.Text
ValueMeaning
TOP_LEFT

The position of the watermark in relation to the top left corner.

TOP_RIGHT

The position of the watermark in relation to the top right corner.

BOTTOM_LEFT

The position of the watermark in relation to the bottom left corner.

BOTTOM_RIGHT

The position of the watermark in relation to the bottom right corner.

watermark

anchor*

1.0.0Specifies the position of the watermark in relation to the corresponding corner of the watermark.Text
ValueMeaning
BOTTOM_LEFT

The position of the watermark in relation to the lower left corner of the watermark.

watermark

watermarkBarcode

format

1.0.0Specifies standard for one-dimensional barcodes (writing information on one line, in the form of dashes). Text
ValueMeaning
CODE_39

Barcode with variable-length alphanumeric characters to store 43 different characters. Each sign consists of 9 elements (light and dark bars), 3 of which are significantly wider. This format allows you to encode numbers, capital letters and characters (-, ., (Space), $, /, +,%, *).

Char
Value
Char
Value
Char
Value
Char
Value
0
0
B
11
M
22
X
33
1
1
C
12
N
23
Y
34
2
2
D
13
O
24
Z
35
3
3
E
14
P
25
-
36
4
4
F
15
Q
26
.
37
5
5
G
16
R
27
space
38
6
6
H
17
S
28
$
39
7
7
I
18
T
29
/
40
8
8
J
19
U
30
+
41
9
9
K
20
V
31
%
42
A
10
L
21
W
32
  

CODE_93

The barcode is an improvement of the CODE_39 format. Like its prototype, it stores 43 alphanumeric characters, but additionally has 4 control characters (($), (%), (/), (+)).
The code accepts only uppercase letters.

 Char
Value
Char
Value
Char
Value
Char
Value
0
0
C
12
O
24
-
36
1
1
D
13
P
25
.
37
2
2
E
14
Q
26
space
38
3
3
F
15
R
27
$
39
4
4
G
16
S
28
/
40
5
5
H
17
T
29
+
41
6
6
I
18
U
30
%
42
7
7
J
19
V
31
($)
43
8
8
K
20
W
32
(%)
44
9
9
L
21
X
33
(/)
45
A
10
M
22
Y
34
(+)
46
B
11
N
23
Z
35
  

Code 93

CODE_128

Variable length, high density alphanumeric code. It can encode characters from the entire ASCII range.

watermark

watermarkBarcode

codeWidth

1.0.0Defines the width of the barcode in pixels.IntegerThe parameter does not define the maximum width of the barcode - in the case when the substituted value turns out to be too long, the width will be automatically increased.

watermark

watermarkBarcode

codeHeight

1.0.0Defines the height of the barcode in pixels.Integer 

watermark

watermarkText

size

1.0.0Text size.Float 

watermark

watermarkText

encoding

1.0.0Character encoding.Text
ValueMeaning
CP1250A code page for the representation of texts in Central European languages using the Latin alphabet, for example Albanian, Croatian, Czech, Polish, Romanian, Slovak, Slovenian, Hungarian.
CP1252A code page to represent texts in Western European languages.
CP1257A code page used to represent texts in Estonian, Lithuanian or Latvian. This set is largely compatible with ISO 8859-13, and is suitable for coding the Polish language.
MACROMANCharacter encoding mainly used in classic Mac OS to represent text. It encodes 256 characters, the first 128 of which are identical to ASCII and the remaining characters include math symbols, diacritics, and additional punctuation marks. It is suitable for English and several other Western languages.

watermark

watermarkText

color

1.0.0The color of the text.Text
ValueMeaning
WHITEWhite
LIGHT_GRAYLight gray
GRAYGray
DARK_GRAYDark gray
BLACKBlack
REDRed
PINKPink
ORANGEOrange
YELLOWYellow
GREENGreen
MAGENTAMagenta
CYANCyan
BLUEBlue

watermark

watermarkText

fontType

1.0.0Text font type.Text
ValueMeaning
COURIERCourier
COURIER_BOLDCourier Bold
COURIER_OBLIQUECourier Oblique
COURIER_BOLDOBLIQUECourier Bold Oblique
HELVETICAHelvetica
HELVETICA_BOLDHelvetica Bold
HELVETICA_OBLIQUEHelvetica Oblique
HELVETICA_BOLDOBLIQUEHelvetica Bold Oblique
SYMBOLSymbol
TIMES_ROMANTimes Roman
TIMES_BOLDTimes Bold
TIMES_ITALICTimes Italic
TIMES_BOLDITALICTimes Bold Italic
ZAPFDINGBATSZapf Dingbats

watermark

watermarkText

rotation

1.0.0Watermark rotation.FloatThe value between 0.0 and 360.0.

Permissions

groups

1.0.0Permissions defining for which users logged in to the system the hook will be run when trying to open a document.Array of text valuesOptional parameter, when is not filled, everyone can see the watermark.
[
  {
   "documentClassId": 5,
   "watermark": {
        "type": "TEXT",
        "text": "Case number: {10}, Registration date: {11}",
        "positionX%": 5,
        "positionY%": 5,
        "opacity": 0.7,
        "alignment": "TOP_LEFT",
        "anchor": "BOTTOM_LEFT",
        "watermarkText":{
            "size": 15,
            "encoding": "CP1252",
            "color": "LIGHT_GRAY",
            "fontType": "HELVETICA",
            "rotation": 0
        }
    },
   "permissions": {
       "groups": ["Users", "Administrators"]  
    }
  },
  {
   "documentClassId": 5,
   "watermark": {
        "type": "BARCODE",
        "text": "{10}",
        "positionX%": 80,
        "positionY%": 10,
        "opacity": 0.5,
        "alignment": "TOP_LEFT",
        "anchor": "BOTTOM_LEFT",
        "watermarkBarcode":{
            "format": "CODE_128",       
            "codeWidth": 50,
            "codeHeight": 15
        }
    },
   "permissions": {
       "groups": ["Users", "Administrators"]  
    }
  }
]

Example of use for the above JSON configuration.

Original document:

 After opening:

1.0.0

  • Hook adding
 

[  {   "documentClassId": 4,   "watermark": {        "type": "TEXT",        "text": "Numer sprawy: {8}, Data rejestracji: {9}",        "positionX%": 5,        "positionY%": 5,        "opacity": 0.7,        "alignment": "TOP_LEFT",        "anchor": "BOTTOM_LEFT",        "watermarkText":{            "size": 15,            "encoding": "CP1250",            "color": "LIGHT_GRAY",            "fontType": "HELVETICA",            "rotation": 0        }    },   "permissions": {       "groups": ["Users", "Administrators"]      }  },  {   "documentClassId": 4,   "watermark": {        "type": "BARCODE",        "text": "{8}",        "positionX%": 80,        "positionY%": 10,        "opacity": 0.5,        "alignment": "TOP_LEFT",        "anchor": "BOTTOM_LEFT",        "watermarkBarcode":{            "format": "CODE_128",                   "codeWidth": 50,            "codeHeight": 15        }    },   "permissions": {       "groups": ["Users", "Administrators"]      }  }]