Skip to content
Inkoxide

Search covers every page and heading of the docs. Use ↑ ↓ and ↵.

Debugging layout

Edit this page

The code on this page is React’s. How Vue writes it
ReactVue
ClassesclassName="p-4"class="p-4"
PropsheaderRows={1}:header-rows="1" or :headerRows="1"
A prop that is truehyphenatehyphenate
Content per pagerender={({ pageNumber }) => …}<template #render="{ pageNumber, totalPages }">…</template>
The page, deeper downusePage()usePage() (it injects the page)
What to render<Invoice invoice={invoice} />h(Invoice, { invoice })
A template for generateTemplate: ComponentType<{ data }>Template: a component with the prop data

The rest, and Vue’s own API, is in the Vue guide.

The code on this page is React’s. How Svelte writes it
ReactSvelte
ClassesclassName="p-4"class="p-4" (a list or an object of flags too)
Content per pagerender={({ pageNumber }) => …}{#snippet render(page)}{page.pageNumber}{/snippet} inside the Text or View
The page, deeper downusePage()usePage(), while the component is created
What to render<Invoice invoice={invoice} />{ component: Invoice, props: { invoice } }
A template for generateTemplate: ComponentType<{ data }>Template: a component with the prop data

The rest, and Svelte’s own API, is in the Svelte guide.

The code on this page is React’s. How Angular writes it
ReactAngular
Components<View>, <Path>, <TextField><ink-view>, <ink-path>, <ink-text-field>: ink- and the name in kebab case
ClassesclassName="p-4"class="p-4", [class]="…"
PropsheaderRows={1}, size="A4"[headerRows]="1", size="A4" (an attribute is a string: bind numbers)
A prop that is truehyphenatehyphenate
Stylestyle={{ padding: 20 }}[style]="{ padding: 20 }"; [inkStyle] for @media blocks and lists of styles
Content per pagerender={({ pageNumber }) => …}[render]="footer" with <ng-template #footer let-page>{{ page.pageNumber }}</ng-template>
The page, deeper downusePage()injectPage()
What to render<Invoice invoice={invoice} />{ component: Invoice, inputs: { invoice } }
A template for generateTemplate: ComponentType<{ data }>Template: a component with the input data

The rest, and Angular’s own API, is in the Angular guide.

<View debug className="m-4 border-2 p-3">…</View>   // one element
<Page debug>…</Page>                                // the page and everything on it
<Document debug>…</Document>                        // every page

debug draws an element's boxes over the page, like the box model in browser developer tools: the margin in orange, the border in yellow, the padding in green, the content box as a blue outline, and the element's width and height in points as a small label. It works on View, ImageBackground, Text, Image, Svg, Canvas, Table, Row, Cell, Spacer, the fields, Header and Footer; on a Page it also outlines the page margins. A box split across pages is outlined on each page it crosses, and a header or footer on every page.

On a Text, it also outlines the paragraph line by line: each line box as a dashed outline, its baseline, and the glyphs of each run on the line, from the font's ascender to its descender, filled in purple and teal by turns. A run that wraps has a box on each line it reaches, so a Text or Link inside a Text shows where its words landed. Those inner elements are runs of the paragraph's lines, not boxes, so debug on one of them draws nothing: put it on the outer Text.

The outlines are drawn last, on top of the content, and the labels are drawn with lines, so text selection, search, links, bookmarks and form fields are unchanged. It changes the output, so remove it before you ship.

invoice.pdf
Invoice PDF: logo, sender and client addresses, a four-row line-item table, subtotal, tax and a highlighted total due.The same page with the boxes the engine laid out drawn over it: margins, borders, padding and content boxes, each labelled with its width and height in points.
A close-up of the outlined region, where the labels read in points.
  • Margin
  • Border
  • Padding
  • Content

Drawn by the engine’s debug option, sizes in points.

Synced from packages/react/GUIDE.md in the inkoxide repository.