# PDF Documents module

## Activation and loading

PDF Documents is disabled by default. Its PHP class is required only while the module is active. Its JavaScript and CSS are loaded only on the PDF document editor and entry screens.

## Workflow

1. Activate **PDF Documents** under **Plattio Forms > Modules**.
2. Open **Plattio Forms > PDF Documents**.
3. Select a form and a starting template.
4. Build the document with content blocks and the live preview.
5. Select the notifications that should receive the PDF as an attachment.
6. Optionally add `{pdf_download}`, `{pdf_download:ID}`, `{pdf_url}`, or `{pdf_url:ID}` to a confirmation message.
7. Save the document and submit the connected form.

PDF files are generated after validation and file processing, but before notifications are sent. When entry storage is active, the generated document is saved with the entry and can be viewed, downloaded, or regenerated. When entry storage is disabled, the generated file remains available through its secure token for 24 hours and is then cleaned up.

## Templates and themes

The module includes 18 templates in four practical groups:

- Notifications: classic, compact, modern, elegant, and technical.
- Documents: basic document, legal agreement, application, cover page, table report, sidebar document, and event ticket.
- Financial: classic invoice, modern invoice, quote/estimate, and receipt.
- Certificates: classic and modern certificates.

More than 40 color themes are included. Every template can be changed independently after creation.

## Content blocks

- Heading
- Rich text
- All form fields
- Single form field
- Entry metadata
- Image
- Signature
- Invoice table
- Certificate
- Divider
- Spacer
- Page break

Smart Tags can be used in document names, file names, text, headings, headers, footers, invoices, certificates, and selected block settings.

## Security and privacy

- No remote PDF service is used.
- Generated files are stored in a protected uploads subdirectory.
- Public file access uses a random 64-character token.
- Optional access policies support secure-link access, logged-in users, selected WordPress roles, the logged-in entry owner, or a password gate.
- Generated files are removed with their entry and by the plugin uninstall cleanup option.
- Temporary files have scheduled and daily stale-file cleanup.
- The module does not bundle fonts, third-party tracking, telemetry, or external assets.

## Renderer

The bundled renderer is a lightweight PDF 1.4 writer using the standard Helvetica, Times, and Courier PDF fonts. It supports vector backgrounds, borders, tables, pagination, page numbering, JPEG images, WordPress-supported image conversion, and signature images. Developers can replace the final PDF bytes with the `plattio_forms_pdf_render_bytes` filter when a specialized renderer, embedded custom font, PDF/A workflow, or advanced script shaping is required.
