Skip to content
Inkoxide

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

Quick start

Install @inkoxide/angular and render a receipt from an Angular component.

Edit this page

Angular templates to PDF with the Inkoxide engine, in Node and in the browser. A template is a component whose template uses the Inkoxide elements (<ink-document>, <ink-page>, <ink-view>, <ink-text>, <ink-table> and the rest), styled with classes or [style]; the PDF is the same, byte for byte, as the same document written for @inkoxide/react.

The guide says how Angular writes each part of a document, and the API.

Part of Inkoxide. Requires Node.js 22 or later and Angular 21 or 22; ES modules only.

npm install @inkoxide/angular
import { Component, CUSTOM_ELEMENTS_SCHEMA, input } from '@angular/core';
import { renderToFile } from '@inkoxide/angular';

@Component({
  selector: 'app-receipt',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <ink-document [title]="'Receipt for ' + customer()">
      <ink-page size="A6" class="p-8 text-xs text-gray-900">
        <ink-text class="text-lg font-bold">Receipt</ink-text>
        <ink-text class="mb-4 text-gray-500">for {{ customer() }}</ink-text>
        @for (l of lines(); track l.name) {
          <ink-view class="flex-row justify-between border-b border-gray-200 py-1.5">
            <ink-text>{{ l.name }}</ink-text>
            <ink-text>\${{ l.amount.toFixed(2) }}</ink-text>
          </ink-view>
        }
      </ink-page>
    </ink-document>
  `,
})
export class Receipt {
  readonly customer = input.required<string>();
  readonly lines = input.required<{ name: string; amount: number }[]>();
}

await renderToFile(
  { component: Receipt, inputs: { customer: 'Ada Lovelace', lines: [{ name: 'Espresso', amount: 3.2 }] } },
  'receipt.pdf',
);
receipt.pdf
A6 receipt PDF: 'Receipt for Ada Lovelace', three items with prices and a bold total.

Switch to Layout for the boxes the engine laid out.

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

renderToBuffer, renderToFile and renderToStream take a component with the values of its inputs, or a component alone. Classes need @inkoxide/tailwind.

The template is compiled like any other: by your Angular build (the CLI, Analog, ng build of a server), or just in time in a plain Node script, with import '@angular/compiler'; first (signal inputs need the AOT compiler; use @Input() there).

Synced from packages/angular/README.md in the inkoxide repository.