Document: the record becomes letterhead.
This PDF came from the same sale #1052 that appears on the Form page. Customer, line items, totals and signatures come from the data, without going through a text editor.
Sales order no. 1052, as a PDF
The header carries the company. Then come the customer's details, the items table, the total and the signature lines. The total is the same one stored in the database.

A template with the record's fields
The layout is a template that receives the record's fields. The controller gathers the data and returns the finished PDF, ready to download, email or attach.
// Controller: gets the data and returns the PDF$html = MadBlade::renderString($template, ['venda' => $venda,'cliente' => $venda->cliente->nome,'itens' => $itens,'total' => number_format($venda->valor_total, 2, '.', ','),]);return response(MadDocPdf::fromHtml($html, ['paper' => 'A4']))->header('Content-Type', 'application/pdf'); A central place to store documents
The generated app also ships with a ready-made document center. It has folders, tags, favorites, recents, shared with me, archive and trash. That is where you keep what you generated and what you received.

When to use the document
Use the document when a record has to become paper to send, print or sign, always in the same layout.
- Order and quote. Customer, items and total, ready to send to the customer.
- Work order. The service performed and the customer's and technician's signatures.
- Contract. Clauses in running text, page breaks and both parties' signatures.
- Receipt. Amount, tax IDs already formatted and a QR code that leads back to the record.
- Inventory label. A barcode on paper the size of the label.
For several records in a single PDF, with groups and totals, use the report. To create and edit the data, the form. What the document designer delivers is covered under code generation.
What you configure
The layout is built from blocks. These are the settings that change the paper the most.
- Paper and orientation
size - A4 in portrait is the default. For a label, the size can be custom, in millimeters.
- Margins and type
margins - The four margins, the font (
font) and the font size (font-size) for the whole document. - Watermark
watermark-text - A diagonal text on the page, such as COPY, with adjustable opacity, angle and color.
- Field format
format - Currency, number, percentage, date, CPF, CNPJ, CEP or phone. A text before the value, such as "Customer:", goes in
prefix. - Items table
model - The rows of another table, such as the order's products, filtered by the document's record (
filter). - Signature line
role - A line to sign on, with the person's name (
name) and role, such as Customer or Salesperson.
What goes into the Laravel project
The document is a class in app/Control with a method that builds and returns the PDF, as in the snippet above, plus a Blade layout made of <mad-doc-...> tags. In practice:
- One address per record. The route follows the
/app/docs/{documento}/{id}format. Change the number and you get another record's PDF. - PDF button in the list view. A row action (
<mad-nav>) opens that record's document. - PDF built on the server. The file is drawn by DomPDF, an open-source PHP library that runs inside the app.
Like every MadBuilder screen, these files open in your editor, go into your Git and accept hand-written code in protected blocks, which stay there when the screen is regenerated. See how the code is generated.
Questions about the document
Can I put a barcode or QR code on the document?
Yes. Both are ready-made blocks, and the content comes from the record, such as the order number. The barcode uses the Code 128 format by default.
Can the document have more than one page?
Yes. The header and footer repeat on every page, and you can force a page break wherever you like, such as before a contract's terms.
Who can open a document's PDF?
Whoever has permission. The document goes into the role's permission groups like any other screen, and anyone who is not logged in is sent to the login screen.
And more
See also the Form or the page types.
Create an account, build a screen, download the project.
No scheduled demo, no discovery call. If the Laravel that comes out doesn’t pass your team’s review, you lost an afternoon.
- Create an accountOpen beta, no credit card.
- Build a screenVisually, in code, or by asking the AI.
- Download the .zipA Laravel project that runs wherever you want.