Renduva documentation
PDF output
PDF is the default output of the PL/SQL package and the most common one over the HTTP API. Renduva fills the template itself, then hands the filled file to a converter that runs on the same server. This page covers how that works and the PDF options.
Which templates give PDF
| Template | Converted by | Notes |
|---|---|---|
docx (Word) |
LibreOffice | |
pptx (PowerPoint) |
LibreOffice | |
xlsx (Excel) |
LibreOffice | |
html |
Chromium | page size and margins from CSS @page |
md (Markdown) |
Chromium | turned into a plain HTML page first |
txt, zpl |
no PDF | text files and labels have no pages to print |
Ask for it with "output": { "type": "pdf" }. Both converters run as separate programs
(soffice and chromium) on the Renduva server; nothing is sent anywhere else. The office
container image has both. With the RPM, or with the slim image, you install them yourself;
see LibreOffice and Chromium. When the program is
missing, the request fails with 500 and a message that names it.
Chromium loads an HTML page with no network access, no access to the server's files and, in
the office image, with scripts switched off. Pictures must be inline data: URLs. See
HTML templates.
Several records in one PDF
When data is a list of objects, the template is filled once per record and the PDFs are
joined, in order, into one file:
{
"template": "invoice",
"output": { "type": "pdf", "filename": "invoices_october.pdf" },
"data": [ { "customer": "City of Example" }, { "customer": "Town of Sample" } ]
}
- Each record starts on a new page, with its own headers, footers and page numbers.
- For Office templates, one LibreOffice run converts all the records of a request. For HTML and Markdown templates, Chromium runs once per record.
- If one record cannot be filled, the whole request fails and the message says which record
(
record 3: ...). There is no partial PDF. - Only PDF output merges Office and HTML templates. Asking for
docx,pptx,xlsx,htmlor OpenDocument output with more than one record is an error. - With
"duplex": trueinoutput.options(Professional), each record is padded to an even number of pages, so every record starts on the front of a sheet when printed on both sides. - Page numbers from a stamp count the whole file; with
"scope": "part"they count each record's pages on its own.
Merging documents
POST /merge (Professional and up) joins PDFs you have already made into one file, in order:
for example, a bill run that makes an invoice and a covering letter per customer with separate
requests, then one PDF to print or archive. The server keeps nothing between requests: you
send the documents with the merge.
{
"documents": [
{ "pdf": "<base64 of the first invoice>", "title": "Invoice 2026-0042, City of Example" },
{ "pdf": "<base64 of a letter>", "title": "Letter, City of Example" },
"<base64 of a PDF without a title>"
],
"output": {
"filename": "bill_run_october.pdf",
"options": {
"duplex": true,
"stamps": [ { "text": "Page {page} of {pages}", "scope": "part" } ]
}
}
}
documentsholds base64 PDFs, each as text or as{"pdf": ..., "title": ...}. A title becomes a bookmark, shown in the PDF reader's sidebar, that opens the document's first page.output.typeispdf, and may be left out.output.optionstakes the same PDF options as/generate, exceptpdfa: PDF/A is made while converting a template, so merged PDFs cannot become PDF/A.duplexpads every document, and the attached PDFs, to an even number of pages. The blank pages carry stamps that count the whole file, but not stamps with"scope": "part".printworks as in/generate: the merged file goes to a named printer instead of back to you.- A document that is not a readable PDF stops the request:
documents[2] is not a readable PDF. - All documents travel in one request, so the server's request size limit (
-max-body, 50 MB by default; see Administration) caps the merge. Raise it for big runs, or merge in batches and merge the batches.
From PL/SQL, renduva.merge sends the request:
declare
l_docs renduva.blob_list := renduva.blob_list();
l_titles renduva.title_list := renduva.title_list();
begin
for c in (select id, name from customers where billing_day = 1 order by name) loop
l_docs.extend;
l_docs(l_docs.count) := renduva.generate(p_template => 'invoice', p_data => invoice_json(c.id));
l_titles.extend;
l_titles(l_titles.count) := 'Invoice for ' || c.name;
end loop;
l_run := renduva.merge(p_documents => l_docs, p_titles => l_titles, p_filename => 'bill_run.pdf',
p_duplex => true,
p_stamps => '[{"text":"Page {page} of {pages}","scope":"part"}]');
end;
renduva.merge takes p_documents, p_titles (one per document, null for none),
p_filename, p_duplex, p_page_numbers, p_stamps, p_password, p_owner_password and
p_permissions, which work as in generate. One request with several records, when every
document uses the same template, is simpler and faster: see
Several records in one PDF.
PDF forms (Enterprise)
A fillable PDF form, such as an official application or customs form, can be the template:
each form field takes the value of the data key with the field's name. Store it as
templates/<name>.pdf, or send it with "template": {"type": "pdf", "source": "<base64>"}.
{
"template": "permit_application",
"output": { "type": "pdf", "filename": "permit_4711.pdf", "options": { "lock_fields": true } },
"data": { "applicant": "Ana Díaz", "permit_type": "Commercial", "agree": true, "zones": ["A", "C"] }
}
| Field type | Value in the data |
|---|---|
| Text, date | Text or a number, as written in the JSON |
| Checkbox | true, a number other than 0, or "Y", "yes", "on", "true", "x", "1"; anything else clears it |
| Radio buttons, combo box | One of the field's choices; any text for an editable combo box |
| List box | One choice, or a list of choices when the field allows several |
- A field without a key in the data keeps what the form has;
nullor""empties it. Data keys that are not fields are ignored. - A choice the field does not have stops the request:
form field "permit_type" has no choice "Gold"; it has Commercial, Residential. - Several records give one PDF with a filled copy of the form per record, each keeping its own
values. Every PDF option works, and
"lock_fields": truemakes every field read-only, so the filled values cannot be changed in a PDF reader. - Tags such as
{{name}}are not read inside a PDF; only the form fields are filled. For a layout of your own, use a Word or HTML template. - A field is found by its name, or by its alternate name (the tooltip), which is how forms made from Word templates (below) name their fields.
Fillable fields from a Word template
A Word template can make a fillable PDF of its own: put content controls where the reader
types or ticks (Word's Developer tab: Plain Text, Check Box, Combo Box, Drop-Down List), give
each one a Title in its Properties, and ask for "form_fields": true:
"output": { "type": "pdf", "options": { "form_fields": true } }
The rest of the template is filled as usual, so a letter can carry the reader's name and still leave the reply fields empty for them. Each control becomes a PDF field whose alternate name is the control's Title: list the fields to see them, and fill the PDF later as a form template with data keys named after the Titles.
- Without
form_fields, the controls print as plain text, as LibreOffice does by default. - Word's older form fields (Legacy Tools) do not become PDF fields; use content controls.
- A field is as wide as the control's placeholder text in Word, so make the placeholder as wide as the longest value.
- It works for Word, Excel and PowerPoint templates (Enterprise); for HTML, Markdown and PDF templates it is an error.
Listing the fields of a form
POST /fields lists the fields of a PDF form with their type, choices and current value: to
find the names your data needs, or to read a form someone filled in and sent back.
{ "document": { "type": "pdf", "source": "<base64 of the form>" } }
document may also be a stored template's name. The answer:
{
"fields": [
{ "name": "applicant", "type": "text", "value": "", "pages": [1] },
{ "name": "_2", "alt_name": "phone", "type": "text", "value": "", "pages": [1] },
{ "name": "permit_type", "type": "radio", "value": "", "options": ["Commercial", "Residential"], "pages": [1] },
{ "name": "agree", "type": "checkbox", "value": false, "pages": [2] }
],
"request_id": "..."
}
Types are text, date, checkbox, radio, combo and list; alt_name is the field's
tooltip, when it has one. A list box's value is a list;
multiple, editable, multiline and locked appear when they apply. From PL/SQL,
renduva.form_fields(l_pdf) returns the fields list as JSON, ready for json_table:
select f.name, f.value
from json_table(renduva.form_fields(:P10_UPLOADED_FORM), '$[*]'
columns (name varchar2(200) path '$.name', value varchar2(4000) path '$.value')) f;
Digital signatures (Enterprise)
Renduva can sign the PDFs it makes, so readers can check who issued a document and that nobody changed it afterwards. The signature is the last change to the file: everything else in a request (merging, stamps, forms, passwords) happens first.
Setting up a signer
The admin adds the certificate once, by name, on the server, on the admin UI's Signers page or with a command. Callers name it and never send a key:
renduva signer add finance finance.p12 # asks for the .p12 password
renduva signer add finance cert.pem key.pem # or PEM files: certificates, then the key
renduva signer list # name, subject, issuer, expiry
renduva signer remove finance
The Signers page takes the same files by upload and warns 30 days before a certificate
expires. With the command, in the container, copy the file in first (docker cp finance.p12 renduva:/tmp/, then
docker exec -it renduva renduva signer add finance /tmp/finance.p12 and delete
/tmp/finance.p12). With the RPM, run it as the renduva user in /var/lib/renduva. Each
signer is kept as signers/<name>.pem in the working folder, readable by the server's user
only; the .p12 password is not stored. Back up the signers folder with the rest.
Certificate files
| File | Accepted |
|---|---|
.p12 or .pfx (PKCS#12) |
Yes: the key, the certificate and any intermediates in one file |
Certificate .pem, .crt or .cer |
As PEM text (starts with -----BEGIN CERTIFICATE-----) or binary (DER, common for .cer files from Windows): the signer's certificate first, then any intermediates |
Key .pem or .key |
As unencrypted PEM text: BEGIN PRIVATE KEY, BEGIN RSA PRIVATE KEY or BEGIN EC PRIVATE KEY |
Intermediate certificates go in the same file as the signer's, after it. To join files kept apart, convert any binary ones to PEM first, then put them together:
openssl x509 -inform der -in intermediate.cer -out intermediate.pem
cat cert.pem intermediate.pem > chain.pem
A password-protected key (BEGIN ENCRYPTED PRIVATE KEY) is best put into a .p12 together
with its certificates, so the key never sits on disk without a password:
openssl pkcs12 -export -in chain.pem -inkey key.pem -out finance.p12
renduva signer add finance finance.p12
OpenSSL asks for the key's password, then for a password for the new .p12. Or remove the
key's password, add the signer, and delete the unprotected copy straight away:
openssl pkey -in key.pem -out key-plain.pem # asks for the key's password
renduva signer add finance chain.pem key-plain.pem
rm key-plain.pem
Keys kept on a hardware token or HSM, which cannot be exported, are not supported.
Signing a document
"output": {
"type": "pdf",
"options": {
"sign": {
"signer": "finance",
"reason": "Invoice approved",
"location": "Santiago, Chile",
"visible": { "page": -1, "position": "bottom-right" },
"timestamp": true
}
}
}
| Field | Default | Meaning |
|---|---|---|
signer |
(required) | A signer added on the server |
name |
the certificate's name | The signer's name as shown, e.g. the person who approved |
reason, location, contact |
none | Shown in the PDF reader's signature panel, and in the box |
visible |
none: an invisible signature | A box with the name, reason, location and date: page (1 is the first, -1 the last; default 1), position (as for stamps; default bottom-right), width and height in points (default 200 by 60), date_format (the box's date, as a template date format such as DD/MM/YYYY HH24:MI, with month and day names in the request's locale; default YYYY-MM-DD) and time_zone (an IANA name such as America/Bogota; default UTC) |
timestamp |
false |
A trusted time from the server's timestamp server, so the signature stays checkable after the certificate expires (PAdES B-T) |
certify |
none: an approval signature | Certifies the document as its author and says what may change afterwards: no-changes, forms (filling in form fields) or forms-and-comments. Certifying signatures are invisible |
The signatures follow PAdES (ETSI), the format the EU's eIDAS rules and PDF readers expect: B-B, or B-T with a timestamp. The name, reason and location in the box are drawn in Western European characters; the signature itself keeps them as given.
Trusted certificates
A PDF reader shows a signature as valid when the certificate comes from an authority it
trusts. For Adobe Acrobat and Reader, that means a certificate from a member of the Adobe
Approved Trust List (AATL), or a qualified certificate from the EU Trusted Lists; your
certificate provider can tell you which theirs is. A self-signed certificate or one from your
own company authority signs correctly, but readers show "validity unknown" until each user
trusts it. Many trusted document-signing certificates are issued on a hardware token or kept by
the provider; Renduva needs one it can read as a .p12 or PEM file.
Timestamps
"timestamp": true needs a timestamp server (RFC 3161), set when the server starts:
renduva serve -tsa https://timestamp.example.com/. Your certificate provider usually runs
one. The server must reach it over the network, so on a server without internet access, leave
timestamps out or use a timestamp server inside your network.
Rules and errors
| Request | Message starts with |
|---|---|
No signer |
output.options.sign.signer is required |
| A signer the server does not have | output.options.sign: no signer named "x"; this server has ... |
| A certificate not yet valid, or expired | output.options.sign: signer x: its certificate is valid from ... to ... |
timestamp without a timestamp server |
output.options.sign.timestamp: this server has no timestamp server (the -tsa option) |
certify with visible |
output.options.sign: a certifying signature is invisible |
| A page the PDF does not have | output.options.sign.visible.page is 5; the PDF has 2 pages |
| An unknown time zone | output.options.sign.visible.time_zone "Bogota" is not a time zone; use a name such as America/Bogota |
From PL/SQL, generate and merge take p_sign_with (the signer), p_sign_reason,
p_sign_location, p_sign_visible (a box at the bottom right of page p_sign_page: 1, the
default, or -1 for the last page; p_sign_date_format and p_sign_time_zone set its date) and
p_sign_timestamp. The APEX plug-in has the same
settings in its Digital Signature section. For other
placements or a certifying signature, use the HTTP API.
Document title
The file name in output.filename, without its extension, becomes the PDF's title, so a
browser tab shows invoices_october instead of the URL. With no file name, the title is
left as the converter made it. In the APEX plug-in this is the File Name setting; in
PL/SQL, p_filename.
Watermark
Without a license (Community mode) every page carries a faint diagonal "Renduva Community" text; with a trial license, "Renduva Trial". In PDF output it is stamped on top of the content of every page after conversion, so table shading cannot hide it, and also on the pages of attached PDFs (below). A paid license removes it. See Licensing.
PDF options
Options in output.options change the PDF: page numbers and stamps need the Professional tier
or higher, and the others the Enterprise tier; a trial license has all of them.
Page numbers and stamps (Professional)
stamps is a list of up to 10 lines of text put on the pages, on top of the content. In the
text, {page} is the page number and {pages} the page count; they run across the whole
finished file, merged records and attached PDFs included.
"options": {
"stamps": [
{ "text": "Page {page} of {pages}" },
{ "text": "COPY", "position": "center", "size": 60, "color": "#CC0000",
"opacity": 0.25, "rotation": 45 },
{ "text": "Original for the customer", "position": "top-right", "pages": "first" }
]
}
| Field | Default | Values |
|---|---|---|
text |
(required) | Up to 200 characters, with {page} and {pages} |
position |
bottom-center |
top-left, top-center, top-right, center, bottom-left, bottom-center, bottom-right; about 1 cm from the edges |
size |
9 |
Font size in points, 4 to 144 |
color |
#555555 |
#RRGGBB |
opacity |
1 |
Above 0 up to 1; 0.25 is faint |
rotation |
0 |
Degrees, counterclockwise, e.g. 45 for a diagonal |
pages |
all |
all, first, not-first, odd, even |
scope |
file |
file: {page} and {pages} count the whole file; part: they count each record, or each merged document, on its own |
The font is Helvetica, which covers English and Western European letters; other scripts are not available in stamps yet.
Enterprise options
"output": {
"type": "pdf",
"filename": "contract.pdf",
"options": {
"password": "s3cret",
"prepend": ["<base64 of a cover letter PDF>"],
"append": ["<base64 of the terms PDF>", "<base64 of a brochure PDF>"]
}
}
"output": { "type": "pdf", "options": { "pdfa": true } }
| Option | Type | Effect |
|---|---|---|
pdfa |
true / false |
A PDF/A-2b file, the ISO format for long-term archiving. Word, PowerPoint and Excel templates only |
password |
text | Needed to open the PDF. AES-256 encryption. The same password also unlocks printing and copying, so it protects who can read the file, not what they do with it |
prepend |
list of base64 PDFs | Put before the document, in the order given |
append |
list of base64 PDFs | Put after the document, in the order given |
lock_fields |
true / false |
Makes every form field read-only, e.g. a filled PDF form |
form_fields |
true / false |
Keeps a Word template's content controls as fillable fields |
sign |
object | A digital signature, the last change to the file |
owner_password |
text | Turns on permissions; whoever has it may do everything. Must differ from password |
permissions |
list | What readers without the owner password may do: print, copy (text and images), edit, annotate (comments), forms (fill in), assemble (insert, rotate, delete pages). An empty list or none: they may only read |
"options": { "owner_password": "only-for-us", "permissions": ["print"] }
With owner_password and no password, anyone can open the file but only print it. Add
password to also need a password to open it. PDF readers honor these restrictions; like
every PDF permission, they stop ordinary use, not a determined person with special tools.
How they combine, in the order Renduva applies them: the records are merged, the attached PDFs are added, the stamps are put on, the title is set, the watermark is stamped, the password and permissions are set, and the signature comes last.
Rules and errors
Each of these stops the request with 422 and a message, and no file:
| Request | Message starts with |
|---|---|
An option name the server does not know, e.g. "pasword" |
output.options: json: unknown field "pasword" |
pdfa together with password |
output.options: a PDF/A file cannot have a password (the standard forbids encryption) |
pdfa together with prepend or append |
output.options: PDF/A output cannot include other PDFs (they may not be PDF/A themselves) |
pdfa with an HTML or Markdown template |
output.options: PDF/A is for Office templates |
| A password longer than 127 bytes | output.options: password is longer than 127 bytes |
pdfa together with stamps |
output.options: PDF/A output cannot have stamps (their font is not embedded) |
pdfa together with owner_password |
output.options: a PDF/A file cannot have permissions |
permissions without owner_password |
output.options.permissions need an owner_password |
owner_password equal to password |
output.options: owner_password must differ from password |
| A permission name the server does not know | output.options.permissions: "fax" is not one of ... |
| More than 10 stamps, an empty text, or a field out of range | output.options: at most 10 stamps, or output.options.stamps[0].<field> ... |
{page} directly followed by a digit, e.g. {page}0 |
... put a space or other character between {page} and a digit |
%p, %P, %t or %v in a stamp's text |
... cannot contain %p, %P, %t or %v |
| An attached file that is not a readable PDF | output.options.append[0] is not a readable PDF (or prepend[n]) |
| Any of the options with an output other than PDF | output.options apply to pdf output only (or ... output has no output options) |
The png preview of a ZPL label has options of its own; see
Previewing a label.
A misspelt option is an error rather than ignored, so a typo never produces an unprotected
file. On a server whose license does not include these options, a request that uses any of
them fails with 403 and a message naming the tier. With PDF output, {}, null,
"pdfa": false and an empty password count as no options and work on every tier.
Attached PDFs travel inside the request as base64, which makes them about a third larger; the whole request must stay under the server's size limit (50 MB by default, see Server options).
From PL/SQL
Both forms of renduva.generate take the same options:
| Parameter | Type | Sent as |
|---|---|---|
p_pdfa |
boolean, default false |
"pdfa": true |
p_password |
varchar2 |
"password"; null sends nothing |
p_prepend |
renduva.blob_list |
"prepend", each BLOB base64-encoded |
p_append |
renduva.blob_list |
"append" |
p_page_numbers |
varchar2 |
A stamp at the bottom center, e.g. 'Page {page} of {pages}' (Professional) |
p_stamps |
clob |
"stamps": a JSON array as above, for other positions, sizes and pages (Professional) |
p_owner_password |
varchar2 |
"owner_password"; null sends no permissions |
p_permissions |
varchar2 |
"permissions", comma-separated, e.g. 'print, copy'; used with p_owner_password |
p_duplex |
boolean, default false |
"duplex": true: each record padded to an even page count (Professional) |
p_lock_fields |
boolean, default false |
"lock_fields": true: form fields made read-only (Enterprise) |
p_form_fields |
boolean, default false |
"form_fields": true: a Word template's content controls kept fillable (Enterprise) |
p_sign_with, p_sign_reason, p_sign_location, p_sign_visible, p_sign_page, p_sign_date_format, p_sign_time_zone, p_sign_timestamp |
"sign": a digital signature (Enterprise) |
l_archive := renduva.generate(p_template => 'invoice', p_data => l_json, p_pdfa => true);
l_mailed := renduva.generate(p_template => 'invoice', p_data => l_json,
p_password => l_customer_pin,
p_prepend => renduva.blob_list(l_cover_pdf),
p_append => renduva.blob_list(l_terms_pdf, l_brochure_pdf));
l_statement := renduva.generate(p_template => 'statement', p_data => l_json,
p_page_numbers => 'Page {page} of {pages}',
p_stamps => '[{"text":"COPY","position":"top-right"}]',
p_owner_password => l_owner_secret,
p_permissions => 'print');
A rule broken here raises ORA-20100 with the server's message, as any other error. The
APEX plug-in has the same options as settings (PDF/A, Password Item, attached PDFs, and in the
26.1 file Page Numbers, Stamp and PDF Permissions); see the APEX plug-in.
Pages in the usage records
For every request with a valid API key the server writes one usage line (see
Usage). For PDF output it includes the number of pages of the
finished file, attached PDFs included; 0 when the file cannot be counted, which can happen
with a password-protected PDF. For every other output pages is 0. A print
request to a PDF printer also returns pages in its answer.
Fonts
LibreOffice and Chromium can only use the fonts installed on the Renduva server. When a template asks for a font the server does not have, the converter picks another, and line and page breaks can move.
The office container image has these font packages from Debian:
| Package | Fonts | Same widths as |
|---|---|---|
fonts-liberation |
Liberation Sans, Serif, Mono | Arial, Times New Roman, Courier New |
fonts-crosextra-carlito |
Carlito | Calibri |
fonts-crosextra-caladea |
Caladea | Cambria |
fonts-dejavu-core |
DejaVu Sans, Serif, Mono |
So documents in Word's usual fonts keep their layout. For other fonts (a corporate font,
Asian scripts), build the office image yourself from Dockerfile.office with the fonts
added, or install them on the RPM host, as described in
LibreOffice and Chromium. HTML templates cannot
load web fonts, so name fonts installed on the server in their CSS.