# @salmonui/export/gantt API reference

> 9 exported symbols of @salmonui/export/gantt: 1 function, 5 interfaces and 3 types.

Canonical: https://salmonui.dev/docs/reference/export/gantt

```ts
import { … } from '@salmonui/export/gantt';
```

## Functions

### exportGanttPdf

Kind: function

Page: https://salmonui.dev/docs/reference/export/gantt/exportGanttPdf

```ts
function exportGanttPdf(model: GanttPdfModel, options?: GanttPdfOptions): Promise<GanttPdfFile>;
```

Writes the Gantt chart as a PDF file.

## Interfaces

### GanttPdfBar

Kind: interface

Page: https://salmonui.dev/docs/reference/export/gantt/GanttPdfBar

```ts
interface GanttPdfBar {
    readonly row: number;
    readonly kind: GanttPdfBarKind;
    readonly x: number;
    readonly width: number;
    readonly top: number;
    readonly height: number;
    readonly progress: number;
    readonly color: string;
    readonly progressColor: string;
    readonly critical?: boolean;
    readonly segments?: readonly {
        readonly x: number;
        readonly width: number;
    }[];
    readonly label?: string;
}
```

One bar of the chart, in px; `row` indexes `GanttPdfModel.rows`, `top` / `height` are inside the row.

Members (12):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `row` | `readonly row: number;` |  |  |
| `kind` | `readonly kind: GanttPdfBarKind;` |  |  |
| `x` | `readonly x: number;` |  |  |
| `width` | `readonly width: number;` |  |  |
| `top` | `readonly top: number;` |  |  |
| `height` | `readonly height: number;` |  |  |
| `progress` | `readonly progress: number;` |  | 0..100. |
| `color` | `readonly color: string;` |  | `#rrggbb`. |
| `progressColor` | `readonly progressColor: string;` |  |  |
| `critical` | `readonly critical?: boolean;` | optional | Outlined with `progressColor`. |
| `segments` | `readonly segments?: readonly {     readonly x: number;     readonly width: number; }[];` | optional | Split task parts (px from the chart start), joined by a dashed line. |
| `label` | `readonly label?: string;` | optional | Drawn after the bar end. |

### GanttPdfFile

Kind: interface

Page: https://salmonui.dev/docs/reference/export/gantt/GanttPdfFile

```ts
interface GanttPdfFile {
    readonly fileName: string;
    readonly mimeType: 'application/pdf';
    readonly data: Uint8Array;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `fileName` | `readonly fileName: string;` |  |  |
| `mimeType` | `readonly mimeType: 'application/pdf';` |  |  |
| `data` | `readonly data: Uint8Array;` |  |  |

### GanttPdfModel

Kind: interface

Page: https://salmonui.dev/docs/reference/export/gantt/GanttPdfModel

```ts
interface GanttPdfModel {
    readonly title?: string;
    readonly direction?: 'ltr' | 'rtl';
    readonly columns: readonly {
        readonly header: string;
        readonly width: number;
        readonly align?: 'start' | 'center' | 'end';
    }[];
    readonly rows: readonly {
        readonly cells: readonly string[];
        readonly depth: number;
        readonly parent: boolean;
        readonly height: number;
    }[];
    readonly chartWidth: number;
    readonly headerHeight: number;
    readonly tiers: readonly {
        readonly cells: readonly {
            readonly x: number;
            readonly width: number;
            readonly text: string;
        }[];
    }[];
    readonly bars: readonly GanttPdfBar[];
    readonly connectors: readonly {
        readonly points: readonly (readonly [
            number,
            number
        ])[];
        readonly color: string;
    }[];
    readonly shades: readonly {
        readonly x: number;
        readonly width: number;
        readonly color: string;
        readonly label?: string;
    }[];
    readonly markers: readonly {
        readonly x: number;
        readonly color: string;
        readonly label?: string;
    }[];
    readonly colors: {
        readonly text: string;
        readonly headerText: string;
        readonly headerBackground: string;
        readonly line: string;
        readonly background: string;
    };
}
```

The laid-out Gantt chart to print, in CSS px.

Members (12):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `title` | `readonly title?: string;` | optional | Document title (`/Title`). |
| `direction` | `readonly direction?: 'ltr' \| 'rtl';` | optional |  |
| `columns` | `readonly columns: readonly {     readonly header: string;     readonly width: number;     readonly align?: 'start' \| 'center' \| 'end'; }[];` |  | Grid pane columns, px widths. |
| `rows` | `readonly rows: readonly {     readonly cells: readonly string[];     readonly depth: number;     readonly parent: boolean;     readonly height: number; }[];` |  | One entry per exported row, top to bottom; `cells` aligned with `columns` (the first cell is indented by `depth`). |
| `chartWidth` | `readonly chartWidth: number;` |  | Chart width in px. |
| `headerHeight` | `readonly headerHeight: number;` |  | Height of the timeline header (all tiers) and of the grid header row, px. |
| `tiers` | `readonly tiers: readonly {     readonly cells: readonly {         readonly x: number;         readonly width: number;         readonly text: string;     }[]; }[];` |  | Timeline header tiers, top to bottom; cells in px from the chart start. |
| `bars` | `readonly bars: readonly GanttPdfBar[];` |  |  |
| `connectors` | `readonly connectors: readonly {     readonly points: readonly (readonly [         number,         number     ])[];     readonly color: string; }[];` |  | Polylines in chart px (y from the top of the first row); the arrow is at the last point, along the last segment. |
| `shades` | `readonly shades: readonly {     readonly x: number;     readonly width: number;     readonly color: string;     readonly label?: string; }[];` |  | Weekend / holiday shading, px. |
| `markers` | `readonly markers: readonly {     readonly x: number;     readonly color: string;     readonly label?: string; }[];` |  | Event markers, px. |
| `colors` | `readonly colors: {     readonly text: string;     readonly headerText: string;     readonly headerBackground: string;     readonly line: string;     readonly background: string; };` |  |  |

### GanttPdfOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/export/gantt/GanttPdfOptions

```ts
interface GanttPdfOptions {
    readonly fileName?: string;
    readonly pageSize?: PdfPageSize | 'A4' | 'A3' | 'Letter' | 'Legal' | readonly [
        number,
        number
    ] | {
        readonly width: number;
        readonly height: number;
    };
    readonly orientation?: 'portrait' | 'landscape';
    readonly fitToWidth?: boolean;
    readonly header?: string;
    readonly footer?: string;
    readonly font?: PdfFont | PdfFontData;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `fileName` | `readonly fileName?: string;` | optional | Default `Gantt.pdf`. |
| `pageSize` | `readonly pageSize?: PdfPageSize \| 'A4' \| 'A3' \| 'Letter' \| 'Legal' \| readonly [     number,     number ] \| {     readonly width: number;     readonly height: number; };` | optional | A PDF writer page size (case-insensitive), or the size in points. Default `a4`. |
| `orientation` | `readonly orientation?: 'portrait' \| 'landscape';` | optional | Default `landscape`. |
| `fitToWidth` | `readonly fitToWidth?: boolean;` | optional | Scales the grid and the whole chart to the page width (one page per row band). Default false. |
| `header` | `readonly header?: string;` | optional | Page header text; `{page}` and `{pages}` are replaced. |
| `footer` | `readonly footer?: string;` | optional | Page footer text; default `{page} / {pages}`. Empty string for none. |
| `font` | `readonly font?: PdfFont \| PdfFontData;` | optional | TrueType font for all text (the PDF writer's `font`): needed outside WinAnsi and for RTL scripts. |

## Types

### GanttPdfBarKind

Kind: type

Page: https://salmonui.dev/docs/reference/export/gantt/GanttPdfBarKind

```ts
type GanttPdfBarKind = 'task' | 'parent' | 'milestone' | 'baseline' | 'unscheduled';
```

## Re-exported entry points

- [@salmonui/export/pdf](https://salmonui.dev/docs/reference/export/pdf.md): 3 symbols: 1 interface and 2 types
  `PdfFont`, `PdfFontData`, `PdfPageSize`
