Search
⌃K
Links
🆕

Password encryption

If needed, encrypt a rendered report with a password.
Either toggle ON the option Set password in the Ninox UI, or alternatively use a custom script and the functions printRecord or printAndSaveRecord.

Option A: without a custom script (Ninox UI)

Option A: Toggle ON Set password (1), enter a password (2), re-enter the password (3), save by clicking Set password (4)
Option A: After clicking Set password, the entered password is saved

Option B: with a custom script

printRecord(this, "templateLayoutName", data)
printAndSaveRecord(this, "templateLayoutName", data)
The data object can include the property _options with pdfPassword which overrides the default settings set by the print engine in the Ninox UI, if you previously toggled OFF Set password.
An empty password like"" will not encrypt your report.

Example

  1. 1.
    Add a new layout element, here: a button.
  2. 2.
    Paste the script below in the formula editor.
  3. 3.
    Save changes.
  4. 4.
    Click or tap the button to run the script.
1
printRecord(this, "en_invoice_template", {
2
date: "02.09.2022",
3
notes: "Net 30",
4
invoiceNumber: "RE-00001",
5
totalNet: "1,342.30 €",
6
totalGross: "€1,597.34",
7
paymentTerm: "30.09.2022",
8
vat: [{
9
rate: "19%",
10
amount: "€255.04"
11
}],
12
customer: {
13
companyName: "Happy GmbH & Co. KG",
14
salutation: "Mrs.",
15
lastName: "Sorglos",
16
department: "Purchasing",
17
address: "Willy-Brandt-Weg 2",
18
postalCode: "10178",
19
city: "Berlin"
20
},
21
contact: {
22
name: "Elsa Excel",
23
phone: "(030) 234 567 89",
24
25
},
26
items: [{
27
pos: 1,
28
article: "Ninox Cloud",
29
number: 10,
30
price: "€120.00",
31
sum: "€1,200.00"
32
}, {
33
pos: 3,
34
article: "Ninox coffee cup (porcelain)",
35
number: 5,
36
price: "€7.50",
37
sum: "€37.50"
38
}, {
39
pos: 4,
40
article: "Ninox coffee cup (recycled)",
41
number: 10,
42
price: "€0.49",
43
sum: "€4.90"
44
}, {
45
pos: 5,
46
article: "Ninox basecap",
47
number: 10,
48
price: "€9.99",
49
sum: "€99.90"
50
}],
51
_options: {
52
pdfPassword: "lite-wake-grill"
53
}
54
})

Result

A report (PDF file) is created and downloaded to your local files. When you open the PDF from your browser, you are prompted to enter a password to open the document.