Repository navigation
Designing reports for Unbox
This page is for designers who draw the layout of a PDF report that developers then build with Unbox. It explains what Unbox does easily, what costs a lot of code, and what a design handover should specify. No programming knowledge is needed.
The short version: a design that consists of text lines, rows of text, tables, backgrounds and borders is cheap to build and easy to maintain. A design that needs drawn shapes aligned with text, elements with a fixed size in a variable grid, or special page-break rules is expensive, and the result is often not better for the reader.
Unbox writes a document from top to bottom. Each element is placed under the previous one; there is no later layout pass that rearranges the page.
| Building block | What it is | Typical use |
|---|---|---|
| Paragraph | One block of text. It wraps, aligns left, center or right, and can mix fonts, sizes and colors within one line. | Titles, labels, values, notes |
| Row / column | A group of elements side by side or stacked, with proportional widths. | Title left and project name right; a value with a small caption under it |
| Table | Rows of cells with a column model. It breaks between rows and repeats its header on every page. | Any list of records; the body of most reports |
| Decorator | A background or a border on any element, with optional rounded corners. | Bands, highlighted cells, boxes, rules |
| Canvas | A free drawing area for shapes. | Bars, icons, charts |
| Header / footer | Content repeated on every page, with "Page x of y". | Page chrome |
Elements other than tables move to the next page as a whole. A table row also stays on one page. Text that does not fit its box is clipped, cut with an ellipsis, or allowed to overflow, as the design decides.
Ask for these freely. Each is one or two lines of code.
- Fonts, sizes and colors mixed within one line, for example a value in dark text followed by a muted unit.
- Tables with proportional column widths, horizontal rules only, vertical rules only, or both.
- Header rows that repeat on every page, and footer rows styled like headers.
- Row and cell backgrounds, including conditional colors such as a red fill for an exceeded value.
- Rounded boxes with a border and a fill, for banners and cards.
- Several stacked text lines inside one table cell, such as a name with a reference code and a rating line under it.
- Full-width section bands inside a table.
- Own TrueType fonts, including bold and italic faces, as long as the font files are provided.
- Page numbers, a repeated header and a repeated footer with a rule.
- Measurements in millimetres or points.
Each of these has cost far above its visible effect. The cheaper alternative gives the reader the same information.
| Expensive element | Why it is expensive | Cheaper alternative |
|---|---|---|
| A drawn shape sitting on a text line, such as a bar beside its percentage | Text and shapes are positioned by different rules. Aligning them needs font metrics and baseline math in the report code. | Put the shape in a row of its own, full width, with the number above or below it. Or show the number only and use a cell fill for the state. |
| An element that keeps the same absolute size while the number of columns varies | Column widths are proportional. A fixed size needs spacer columns computed per page. | Let the element scale with its column. For an indicator bar this is not a problem. |
| Rules like "keep this block together" or "do not leave one row alone at the page bottom" | Unbox has no orphan control. The report must measure heights and decide page breaks itself. | Give the block its own repeating header, so every page is labelled correctly, and accept normal pagination. Or always start the block on a new page. |
| A page header or footer that differs from the shared one used by the other reports | The shared page master must be replaced, and small features such as the print date are easily lost. | Reuse the shared header and footer. If it needs a variant, request a configurable option in the shared master. |
| Hierarchy through many font sizes and colors instead of a bold face | Each size and color becomes a constant and a decision in code. | Provide a bold face. Two or three sizes plus regular and bold carry a hierarchy well. |
| Several color signals for one state, such as fill, value color, bar color and percentage color | Every signal is a branch in code, and the signals repeat the same message. | Choose two: a cell fill and the value color. |
| The same caption repeated in every column header, such as the unit under every scenario name | Each header cell becomes a container of two lines. | State the unit once, in the title or in the first column header. |
| Special glyphs such as bullets, arrows or Greek letters | The built-in standard fonts cover Latin-1 only. Anything else needs an embedded font. | Use an embedded font anyway when the domain needs the glyphs, but otherwise prefer words or plain punctuation. |
| Text placed at exact coordinates | Unbox flows content; absolute placement fights the flow. | Express positions as rows and columns with proportions. |
Developers can build a design quickly when these points are stated.
- Page: orientation, margins in mm, and whether the report uses the shared page header and footer.
- Fonts: the font files for every face used, including bold. Sizes in points. Note which glyphs outside Latin-1 are needed, if any.
- Colors: a small palette with names. State which colors are conditional and on which rule, for example "fill amber from 80 %, red from 100 %".
- Tables: the columns with their proportions, the alignment per column, the rules (horizontal, vertical, outer frame) and the header style.
- Page breaks: what happens when a table spans pages. The header repeats by default. Say whether anything else must repeat.
- Variable width: what happens when there are more columns than fit on a page. A common answer is "split into column sets of at most n, repeat the first column, label each set".
- Long text: whether text may wrap and grow the row, is cut with an ellipsis, or is clipped.
- Empty states: what the report shows when a value or a whole section is missing, for example an em dash or a note.
A mockup made of stacked rows and tables, drawn with the proportions written next to it, is the ideal input. Pixel-exact artwork is less useful than a clear statement of the rules.
A utilization matrix report was designed with a thin bar next to each percentage, with a constant bar width across pages, its own title block and footer, a consumption block that had to stay on one page, and no bold face. The report was built, but a large share of its code went into the bar alignment, the padding weights for the constant width, the height measurement for the page break and the replacement page chrome. The bar itself renders as a two-point line that is hard to see in print.
The same information fits a cheap design: the value with the percentage as a muted run in the same line, a cell fill for warning and exceeded states, the shared page header and footer, and the consumption block as a second table with its own repeating header. The report would look almost the same and need a fraction of the code.
- Text layout for wrapping, overflow and mixed styles in one line.
- Tables for column widths, rules and repeated headers.
- Styling and custom drawing for backgrounds, rounded borders and drawn shapes.
- Fonts and encoding for embedding TrueType fonts.
Unbox PDF wiki · Source · Examples target Unbox PDF 0.10.1 and Java 17+.
Unbox PDF
Start here
Build your content
Finish your report
Design
Project