View as Markdown

API reference: @salmonui/export/pdf

PdfOptionsinterface

import type { PdfOptions } from '@salmonui/export/pdf';
interface PdfOptions extends ExportWriterOptions {
    readonly pageSize?: PdfPageSize | readonly [
        number,
        number
    ];
    readonly orientation?: 'portrait' | 'landscape';
    readonly margin?: number;
    readonly fontSize?: number;
    readonly columnOverflow?: 'fit' | 'paginate';
    readonly header?: string;
    readonly footer?: string;
    readonly includeHeaders?: boolean;
    readonly title?: string;
    readonly compress?: boolean;
    readonly font?: PdfFont | PdfFontData;
    readonly mergeRepeatedValues?: boolean;
    readonly appendImages?: readonly ExportImage[];
}

PDF writer options.

PdfOptions members (16, 3 inherited)
NameSignatureDescription
pageSizeoptionalreadonly pageSize?: PdfPageSize | readonly [ number, number ];

Default a4, or [width, height] in points.

orientationoptionalreadonly orientation?: 'portrait' | 'landscape';

Default portrait.

marginoptionalreadonly margin?: number;

Page margin in points. Default 36.

fontSizeoptionalreadonly fontSize?: number;

Body font size in points. Default 8.

columnOverflowoptionalreadonly columnOverflow?: 'fit' | 'paginate';

fit (default) scales columns to the page width; paginate continues them on extra page sets.

headeroptionalreadonly header?: string;

Page header text; {page} and {pages} are replaced.

footeroptionalreadonly footer?: string;

Page footer text; default {page} / {pages}. Empty string for none.

includeHeadersoptionalreadonly includeHeaders?: boolean;

Header rows. Default true.

titleoptionalreadonly title?: string;

Document title (/Title).

compressoptionalreadonly compress?: boolean;

Deflate content streams (when the platform has CompressionStream). Default true.

fontoptionalreadonly font?: PdfFont | PdfFontData;

TrueType font bytes (.ttf, or the first font of a .ttc) to embed for all text, required for characters outside WinAnsi (CJK, Cyrillic, Greek, Hebrew, Arabic). Only the used glyphs are embedded. bold defaults to a synthetic bold of regular. No font is bundled.

mergeRepeatedValuesoptionalreadonly mergeRepeatedValues?: boolean;

Merge repeated values in consecutive data rows, as XLSX. Default false.

appendImagesoptionalreadonly appendImages?: readonly ExportImage[];

Pages after the table, one PNG or JPEG image each (width / height in CSS px), scaled down to fit the page body and centered: a chart image beside the table in one PDF. An image that cannot be embedded adds no page.

stylesoptionalinheritedstyles?: ExportStyles;
sliceMsoptionalinheritedsliceMs?: number;

Time slice in ms before the writer yields to the event loop. Default 25.

yieldoptionalinheritedyield?: YieldFn;

Awaited between slices. Default: a macrotask.