# @salmonui/export/graphics API reference

> 11 exported symbols of @salmonui/export/graphics: 4 functions, 4 interfaces and 3 types.

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

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

## Functions

### parseColor

Kind: function

Page: https://salmonui.dev/docs/reference/export/graphics/parseColor

```ts
function parseColor(input: string | undefined): Rgba | null;
```

Parses a CSS color as browsers serialize computed values (hex, `rgb()`,
`hsl()`, `oklch()`, `oklab()`, `color(srgb ...)`, a few names); null for
`none`, `transparent` and anything unknown.

### parseSvgXml

Kind: function

Page: https://salmonui.dev/docs/reference/export/graphics/parseSvgXml

```ts
function parseSvgXml(src: string): El | null;
```

A small, forgiving XML reader for SVG (no DTDs, no namespaces beyond prefixes).

### pathOps

Kind: function

Page: https://salmonui.dev/docs/reference/export/graphics/pathOps

```ts
function pathOps(d: string, m: Mat): string;
```

SVG path data to absolute PDF path operators under `m` (arcs and quadratics become cubics).

### writeGraphicsPdf

Kind: function

Page: https://salmonui.dev/docs/reference/export/graphics/writeGraphicsPdf

```ts
function writeGraphicsPdf(pages: string | GraphicsPdfPage | readonly (string | GraphicsPdfPage)[], options?: GraphicsPdfOptions): Promise<GraphicsPdfFile>;
```

Writes SVG drawings as a vector PDF, one page per drawing, each scaled to fit the page.

## Interfaces

### GraphicsPdfFile

Kind: interface

Page: https://salmonui.dev/docs/reference/export/graphics/GraphicsPdfFile

```ts
interface GraphicsPdfFile {
    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;` |  |  |

### GraphicsPdfOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/export/graphics/GraphicsPdfOptions

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

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `fileName` | `readonly fileName?: string;` | optional | Default `Chart.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 when the drawing is wider than tall. |
| `margin` | `readonly margin?: number;` | optional | Page margin in points. Default 36. |
| `header` | `readonly header?: string;` | optional | Page header text; `{page}` and `{pages}` are replaced. |
| `footer` | `readonly footer?: string;` | optional | Page footer text. Default none. |
| `title` | `readonly title?: string;` | optional | Document title (PDF Info). |
| `font` | `readonly font?: PdfFont \| PdfFontData;` | optional | TrueType font for all text: needed outside WinAnsi. |
| `compress` | `readonly compress?: boolean;` | optional | Deflate the page streams when the platform has `CompressionStream`. Default true. |

### GraphicsPdfPage

Kind: interface

Page: https://salmonui.dev/docs/reference/export/graphics/GraphicsPdfPage

```ts
interface GraphicsPdfPage {
    readonly svg: string;
}
```

One drawing per page.

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `svg` | `readonly svg: string;` |  | Standalone SVG markup (`<svg xmlns=...>`) with resolved colors. |

## Types

### Rgba

Kind: type

Page: https://salmonui.dev/docs/reference/export/graphics/Rgba

```ts
type Rgba = readonly [
    number,
    number,
    number,
    number
];
```

sRGB 0..1 plus alpha.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `0` | `0: number;` | inherited |  |
| `1` | `1: number;` | inherited |  |
| `2` | `2: number;` | inherited |  |
| `3` | `3: number;` | inherited |  |
| `length` | `length: 4;` | inherited |  |

## 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`
