Barcodes and verification codes¶
Pressjet draws barcodes as vectors, and can stamp every page of a document with a code that says where the document came from. A person who holds a printed or forwarded copy scans the code and learns which document it is, which page they hold, and whether the copy still matches the source the issuer keeps.
Barcodes¶
A barcode node draws one symbol. It goes in a page or a view, like a block image, and is never
split across pages.
{
"type": "barcode",
"properties": {
"format": "qr",
"value": "https://example.com/lease/OH-2026-0417",
"style": { "width": 72 }
},
"children": []
}
| Format | Holds | Notes |
|---|---|---|
qr |
Any text, up to 2,331 bytes (at M) |
errorCorrection: L, M (default), Q or H. |
pdf417 |
Any text, up to 1,033 bytes | errorCorrection 0 to 8 (chosen by size when absent), columns 1 to 30. Without columns it takes the shape of its box. |
datamatrix |
Any text, up to 1,555 bytes | Square symbols. |
code128 |
Printable ASCII | A linear code: it fills its box. Give it a width and a height. |
- Size. Without a width or height a code takes one point per module. A two-dimensional code
keeps square modules and is centred in its box, with its quiet zone inside the box. Modules
under 0.25 mm are reported as
barcode_too_small. - Color.
style.colorsets the dark modules; light modules are not painted. - Page numbers.
{pageNumber}and{totalPages}invalueare replaced on each page, as inpageNumberText. - Accessibility. A barcode is a figure in a tagged PDF;
altdescribes it,"Barcode"by default.
"QR Code" is a registered trademark of DENSO WAVE INCORPORATED.
Verification codes¶
The document property verification adds a code to the margin of every page:
{
"type": "document",
"properties": {
"title": "Residential lease",
"verification": { "id": "OH-2026-0417", "url": "https://verify.example.com/check" }
},
"children": []
}
Each page's code carries:
| Field | Meaning |
|---|---|
id |
The document's reference, such as a contract number: 1 to 64 letters, digits or - _ . : /. |
d |
A digest of the source: the first 16 bytes of the SHA-256 of the document JSON with its keys sorted and the verification property left out, in base64url. |
p |
The page number and the page count, such as 3/12. A missing page shows. |
s |
An Ed25519 signature of the id, the digest and the page count, when the server holds a verification key. |
With url, the code is that address with id, v, d, p and s query parameters, so a
phone camera opens the issuer's page. Without it, the code is the text
PJV1:<id>:<digest>:<page>/<total>:<signature>.
| Option | Default | Meaning |
|---|---|---|
format |
qr |
qr, pdf417 or datamatrix. |
position |
bottom-right |
bottom-right, bottom-left, bottom-center, top-right, top-left, left-edge or right-edge. The edge positions run the code and its caption up the side margin, as many legal documents do. |
size |
72 | The code's short side in points, 18 to 144. |
caption |
true |
Print the id and the page number beside the code. |
inset |
centred | Distance from the page edge in points. |
The code never covers content. It is sized to fit the page's own margin (its padding), less a
gap, so a document with narrow margins gets a smaller code rather than one over its text. When a
code would be too small to scan, the layout report says so, and a code that something else is
drawn over is reported as barcode_covered: choose another position or a wider margin.
Checking a code¶
POST /v1/verify reads the text a scanner returns:
{ "version": 1, "code": "https://verify.example.com/check?id=OH-2026-0417&v=1&d=…&p=3/12&s=…" }
{
"valid": true,
"id": "OH-2026-0417",
"digest": "QY7VmyuA4Q_ang5sqG8xaA",
"page": 3,
"totalPages": 12,
"signature": "valid"
}
signatureisvalidorinvalidwhen a public key is known (the request'spublicKey, or else the server's own key),uncheckedwhen the code is signed and no key is known, andabsentwhen the code carries no signature.layout, the source document the issuer kept, addsdocumentMatches: whether the code was printed from exactly that source.validis false when the text is not a verification code, the page is outside1…total, the signature is invalid or the document does not match. A code whose signature isabsentoruncheckedand that was not compared with a document proves only that it is well formed.
/v1/verify answers JSON and may be called with a publishable key, so a verification page can
check codes from the browser. The CLI does the same without a server:
pressjet verify '<scanned text>' --key <public key> --document lease.json
It prints the answer and exits 1 when the code does not hold.
Keys¶
pressjet keys verification
prints a new seed and its public key. Set the seed as PRESSJET_VERIFICATION_KEY on the server
(and wherever pressjet render should sign), and publish the public key: /v1/info lists it as
verificationKey. Without a key, codes carry no signature and /v1/verify can only compare
digests. Rotating the key does not invalidate codes already printed if verifiers keep the old
public key.
What a code does not prove¶
- It is not a digital signature of the PDF. It proves that the issuer produced a document with
this id, source and page count. To bind the PDF bytes themselves, also sign it with
/v1/sign. - A copy can be edited around the code. The code proves which document a page belongs to; to
know whether a printed page says what the source says, compare it with the issuer's copy, which
documentMatchesidentifies. - The signature covers the page count, not each page's content. Pages of two documents with the same id and source cannot be told apart, because they are the same document.