import { default as default_2 } from 'pdfkit'; /** Configuration for a table cell **/ export declare interface Cell extends Omit { /** How many columns this cell covers, follows the same logic as HTML `colspan` **/ colspan?: number; /** How many rows this cell covers, follows the same logic as HTML `rowspan` **/ rowspan?: number; /** * The text value * * This will be cast to a string * unless it is a boolean in which it will be converted to ✓ (tick) or ✕ (cross) * * Note that null and undefined are not rendered but the cell is still outlined */ value?: any; /** * The padding for the cell * * @default 0.25em */ padding?: SideDefinition; /** * The border for the cell * * @default 1pt */ border?: SideDefinition; /** The border colors for the cell **/ borderColor?: SideDefinition; /** The color of the cell **/ backgroundColor?: PDFColor; /** The color of the text **/ textColor?: PDFColor; /** * The text stroke * * @default 0 */ textStroke?: Wideness; /** The text stroke color **/ textStrokeColor?: PDFColor; /** * The alignment of the text * * To define both horizontal and vertical as centered use 'center' * Otherwise define the x and y alignments in an object * * @default { x: 'left', y: 'center' } */ align?: 'center' | { x?: 'left' | 'center' | 'right' | 'justify'; y?: 'top' | 'center' | 'bottom'; }; /** The font of the text **/ font?: string; /** The font family of the text **/ fontFamily?: string; /** The font size of the text **/ fontSize?: Size; /** Override the position of the cell **/ x?: Size; /** Override the position of the cell **/ y?: Size; /** Render the debug lines of the cell **/ debug?: boolean; } declare type ExpandedSideDefinition = { top: T; right: T; bottom: T; left: T; }; declare class ExtendedPDFDocument extends default_2 { /** The documents current font **/ currentFont: PDFFontSource; /** The documents current font family (if provided) **/ currentFontFamily?: string; page: PDFPage; options: ExtendedPDFDocumentOptions; private _fontSize; private _registeredFonts; private _ctm; private _pageBuffer; private _root; private readonly remSize; constructor(options?: ExtendedPDFDocumentOptions); addPage(options?: ExtendedPDFDocumentOptions): this; /** The documents current font size (in points) **/ get currentFontSize(): number; font(src: PDFFontSource, family?: string | number, size?: number): this; fontSize(size: Size): this; table(opts?: PDFTableOpts): PDFTable; /** * Convert a {@link Size} into a point measurement * * @param size - The string to convert * @param defaultValue - The default value when undefined * @param page - The page used for computing font sizes */ sizeToPoint(size: Size | boolean | undefined, defaultValue?: Size | boolean | undefined, page?: PDFPage): number; } export default ExtendedPDFDocument; export declare type ExtendedPDFDocumentOptions = Omit & { lazyRegisterFont?: (document: ExtendedPDFDocument, src: string, family: string | undefined) => void; /** The document default font size **/ fontSize?: Size; /** The document default font **/ font?: string; /** The document default font family **/ fontFamily?: string; /** * The page margins * * @alias margins */ margin?: SideDefinition; /** * The page margins * * @alias margin */ margins?: SideDefinition; size?: [number, number] | string | undefined; }; declare type HexColor = `#${string}`; declare type NamedColor = 'aliceblue' | 'antiquewhite' | 'aqua' | 'aquamarine' | 'azure' | 'beige' | 'bisque' | 'black' | 'blanchedalmond' | 'blue' | 'blueviolet' | 'brown' | 'burlywood' | 'cadetblue' | 'chartreuse' | 'chocolate' | 'coral' | 'cornflowerblue' | 'cornsilk' | 'crimson' | 'cyan' | 'darkblue' | 'darkcyan' | 'darkgoldenrod' | 'darkgray' | 'darkgreen' | 'darkgrey' | 'darkkhaki' | 'darkmagenta' | 'darkolivegreen' | 'darkorange' | 'darkorchid' | 'darkred' | 'darksalmon' | 'darkseagreen' | 'darkslateblue' | 'darkslategray' | 'darkslategrey' | 'darkturquoise' | 'darkviolet' | 'deeppink' | 'deepskyblue' | 'dimgray' | 'dimgrey' | 'dodgerblue' | 'firebrick' | 'floralwhite' | 'forestgreen' | 'fuchsia' | 'gainsboro' | 'ghostwhite' | 'gold' | 'goldenrod' | 'gray' | 'grey' | 'green' | 'greenyellow' | 'honeydew' | 'hotpink' | 'indianred' | 'indigo' | 'ivory' | 'khaki' | 'lavender' | 'lavenderblush' | 'lawngreen' | 'lemonchiffon' | 'lightblue' | 'lightcoral' | 'lightcyan' | 'lightgoldenrodyellow' | 'lightgray' | 'lightgreen' | 'lightgrey' | 'lightpink' | 'lightsalmon' | 'lightseagreen' | 'lightskyblue' | 'lightslategray' | 'lightslategrey' | 'lightsteelblue' | 'lightyellow' | 'lime' | 'limegreen' | 'linen' | 'magenta' | 'maroon' | 'mediumaquamarine' | 'mediumblue' | 'mediumorchid' | 'mediumpurple' | 'mediumseagreen' | 'mediumslateblue' | 'mediumspringgreen' | 'mediumturquoise' | 'mediumvioletred' | 'midnightblue' | 'mintcream' | 'mistyrose' | 'moccasin' | 'navajowhite' | 'navy' | 'oldlace' | 'olive' | 'olivedrab' | 'orange' | 'orangered' | 'orchid' | 'palegoldenrod' | 'palegreen' | 'paleturquoise' | 'palevioletred' | 'papayawhip' | 'peachpuff' | 'peru' | 'pink' | 'plum' | 'powderblue' | 'purple' | 'red' | 'rosybrown' | 'royalblue' | 'saddlebrown' | 'salmon' | 'sandybrown' | 'seagreen' | 'seashell' | 'sienna' | 'silver' | 'skyblue' | 'slateblue' | 'slategray' | 'slategrey' | 'snow' | 'springgreen' | 'steelblue' | 'tan' | 'teal' | 'thistle' | 'tomato' | 'turquoise' | 'violet' | 'wheat' | 'white' | 'whitesmoke' | 'yellow' | 'yellowgreen'; declare type PDFColor = HexColor | NamedColor | PDFKit.Mixins.ColorValue; declare type PDFDocumentOptions = PDFKit.PDFDocumentOptions; declare type PDFFontSource = PDFKit.Mixins.PDFFontSource; export declare class PDFPage { document: ExtendedPDFDocument; size: string | [number, number]; layout: 'portrait' | 'landscape'; margins: ExpandedSideDefinition; width: number; height: number; content: PDFKit.PDFKitReference; resources: PDFKit.PDFKitReference; dictionary: PDFKit.PDFKitReference; markings: never[]; constructor(document: ExtendedPDFDocument, options?: ExtendedPDFDocumentOptions); get fonts(): any; get xobjects(): any; get ext_gstates(): any; get patterns(): any; get colorSpaces(): any; get annotations(): any; get structParentTreeKey(): any; maxY(): number; write(chunk: any): void; end(): void; get contentWidth(): number; get contentHeight(): number; } export declare class PDFTable { private readonly document; private readonly _opts; private _cellWidth; readonly cellHeight: number; private currCellX; private currCellY; private cellClaim; private readonly x; private readonly y; private _width; readonly height: number; private readonly border; private readonly borderColor; private cols?; constructor(document: ExtendedPDFDocument, _opts: PDFTableOpts); get opts(): Readonly; get width(): number; get cellWidth(): number; private initCellWidth; /** * Draws a row of cells to the table * * @example * ``` * doc.table() * .row(['A', 'B', 'C']) * .row(['D', 'E', 'F']) * ``` * would render a 3x2 table * * | A | B | C | * | --- | --- | --- | * | D | E | F | * * @param cells - The cells to render * @param defaultCell - Any config you wish to apply to all cells in this row */ row(cells: Iterable, defaultCell?: Cell): this; /** * Indicates to the table that it is finished * * so that it can do any cleanup such as drawing the bottom border * * Not strictly required to call but may leave your table in an undesirable state * * @returns the document */ end(): ExtendedPDFDocument; private renderCell; private renderBorder; } export declare type PDFTableOpts = { /** Number of columns you wish to divide the table into, allowing the width of a cell to be calculated **/ cols?: number; /** Number of rows you wish to divide the table into, allowing the height of a cell to be calculated **/ rows?: number; /** * Height of a cell * * If not provided it will compute it based on height / rows * * @note If neither rows nor cellHeight is provided, the default of 2em is used */ cellHeight?: Size; /** * Width of a cell * * If not provided it will compute it based on width / cols * * @note If neither cols nor cellWidth is provided, the default of 25% of the table width is used */ cellWidth?: Size; /** Position of the table **/ x?: Size | undefined; /** Position of the table **/ y?: Size | undefined; /** The width of the table, undefined for page width **/ width?: Size | undefined; /** The height of the table **/ height?: Size | undefined; /** * The thickness of the tables border * * Default is 0, so no table border (as the cells render it) */ border?: SideDefinition; /** The border color of the table **/ borderColor?: SideDefinition; /** Any config you wish to apply to all cells **/ defaultCell?: Cell; }; declare type PDFTextOptions = PDFKit.Mixins.TextOptions; /** * Side definitions * * - To define all sides, use a single value * - To define up-down left-right, use a `[Y, X]` array * - To define each side, use `[top, right, bottom, left]` array * - Or `{vertical: SideValue, horizontal: SideValue}` * - Or `{top: SideValue, right: SideValue, bottom: SideValue, left: SideValue}` **/ declare type SideDefinition = T | [T, T] | [T, T, T, T] | { vertical: T; horizontal: T; } | { top: T; right: T; bottom: T; left: T; }; /** Measurement of size **/ export declare type Size = number | `${number}` | `${number}${'em' | 'in' | 'px' | 'cm' | 'mm' | 'pc' | 'ex' | 'ch' | 'rem' | 'vw' | 'vmin' | 'vmax' | '%' | 'pt'}`; /** Measurement of how wide something is, false means 0 and true means 1 **/ export declare type Wideness = Size | boolean; export { }