@types/pdfkit
Advanced tools
+106
-0
@@ -401,2 +401,102 @@ /// <reference types="node" /> | ||
| interface CellStyle { | ||
| /** The border for the cell (default 1pt) */ | ||
| border?: boolean | number | Array<boolean | number> | { | ||
| top?: number; | ||
| right?: number; | ||
| bottom?: number; | ||
| left?: number; | ||
| } | undefined; | ||
| /** The border colors for the cell (default black) */ | ||
| borderColor?: string | Array<string> | { | ||
| top?: ColorValue; | ||
| right?: ColorValue; | ||
| bottom?: ColorValue; | ||
| left?: ColorValue; | ||
| }; | ||
| /** Set the background color of the cell */ | ||
| backgroundColor?: ColorValue; | ||
| } | ||
| interface TableOptions { | ||
| /** The position of the table (default {x: doc.x, y: doc.y}) */ | ||
| position?: { x?: number; y?: number }; | ||
| /** The maximum width the table can expand to (defaults to the remaining content width (offset from the tables position)) */ | ||
| maxWidth?: number; | ||
| /** Column definitions of the table. (default auto) */ | ||
| columnStyles?: number | Array<number | string> | CellStyle | ((row: number) => number | CellStyle | undefined); | ||
| /** Row definitions of the table. (default *) */ | ||
| rowStyles?: number | Array<number | string> | CellStyle | ((row: number) => number | CellStyle | undefined); | ||
| /** Defaults to apply to every cell */ | ||
| defaultStyle?: | ||
| & (number | Array<number | string> | CellStyle | ((row: number) => number | CellStyle | undefined)) | ||
| & { width?: number }; | ||
| /** Whether to show the debug lines for all the cells (default false) */ | ||
| debug?: boolean; | ||
| } | ||
| interface TableOptionsWithData extends TableOptions { | ||
| /** The data to render (not required, you can call .row()). This can be an iterable (async or sync) */ | ||
| data: Array<Array<string | CellOptions>>; | ||
| } | ||
| interface CellOptions extends CellStyle { | ||
| /** The value, will be cast to a string (null and undefined are not rendered but the cell is still outlined) */ | ||
| text?: string | undefined | null; | ||
| /** How many rows this cell covers, follows the same logic as HTML rowspan */ | ||
| rowSpan?: number; | ||
| /** How many columns this cell covers, follows the same logic as HTML colspan */ | ||
| colSpan?: number; | ||
| /** The padding for the cell (default 0.25em) */ | ||
| padding?: string; | ||
| /** Font options for the cell */ | ||
| font?: any; | ||
| /** The alignment of the cell text (default {x: 'left', y: 'top'}) */ | ||
| align?: { x?: "right" | "left"; y?: "top" | "bottom" }; | ||
| /** The text stroke (default 0) */ | ||
| textStroke?: number | boolean; | ||
| /** Sets the text stroke color of the cells text (default black) */ | ||
| textStrokeColor?: ColorValue; | ||
| /** Sets the text color of the cells text (default black) */ | ||
| textColor?: ColorValue; | ||
| /** Sets the cell type (for accessibility) (default TD) */ | ||
| type?: string; | ||
| /** Sets any text options you wish to provide (such as rotation) */ | ||
| textOptions?: TextOptions; | ||
| /** Whether to show the debug lines for the cell (default false) */ | ||
| debug?: boolean; | ||
| } | ||
| interface ColumnOptions extends CellOptions { | ||
| /** The width of the column (default *) */ | ||
| width?: string | number; | ||
| /** The minimum width of the column (default 0) */ | ||
| minWidth?: string | number; | ||
| /** The maximum width of the column (default Infinity) */ | ||
| maxWidth?: string | number; | ||
| } | ||
| interface RowOptions extends CellOptions { | ||
| /** The height of the row (default auto) */ | ||
| height?: string | number; | ||
| /** The minimum height of the row (default 0) */ | ||
| minHeight?: string | number; | ||
| /** The maximum height of the row (default Infinity) */ | ||
| maxHeight?: string | number; | ||
| } | ||
| interface PDFTableObject { | ||
| /** Add a row of data (null and undefined are not rendered) */ | ||
| row(data: Array<string | undefined | null | RowOptions>): this; | ||
| /** Indicates to the table that it is finished, allowing the table to flush its cell buffer (which should be empty unless there is rowSpans) */ | ||
| end(): PDFDocument; | ||
| } | ||
| interface PDFTable { | ||
| /** Draw a table in PDFKit document. */ | ||
| table(options?: TableOptions): PDFTableObject; | ||
| /** Draw a table in PDFKit document. */ | ||
| table(options: TableOptionsWithData): PDFDocument; | ||
| } | ||
| interface TextOptions { | ||
@@ -709,2 +809,3 @@ /** Set to false to disable line wrapping all together */ | ||
| Mixins.PDFImage, | ||
| Mixins.PDFTable, | ||
| Mixins.PDFText, | ||
@@ -931,2 +1032,7 @@ Mixins.PDFVector, | ||
| declare module "pdfkit/js/mixins/table" { | ||
| var PDFKitTable: PDFKit.Mixins.PDFTable; | ||
| export = PDFKitTable; | ||
| } | ||
| declare module "pdfkit/js/mixins/text" { | ||
@@ -933,0 +1039,0 @@ var PDFKitText: PDFKit.Mixins.PDFText; |
| { | ||
| "name": "@types/pdfkit", | ||
| "version": "0.13.9", | ||
| "version": "0.14.0", | ||
| "description": "TypeScript definitions for pdfkit", | ||
@@ -56,4 +56,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pdfkit", | ||
| "peerDependencies": {}, | ||
| "typesPublisherContentHash": "f64487d8e465b93c3e78b48cd8ff0d1e1137195d39f231f16195d45a5aa554ba", | ||
| "typeScriptVersion": "5.0" | ||
| "typesPublisherContentHash": "2b0fa9ab840f06e7670ca1df7a4a654e4517d5aad86f4eebcf51b4f404baf6e5", | ||
| "typeScriptVersion": "5.1" | ||
| } |
+1
-1
@@ -11,3 +11,3 @@ # Installation | ||
| ### Additional Details | ||
| * Last updated: Wed, 29 Jan 2025 17:33:21 GMT | ||
| * Last updated: Wed, 11 Jun 2025 15:03:38 GMT | ||
| * Dependencies: [@types/node](https://npmjs.com/package/@types/node) | ||
@@ -14,0 +14,0 @@ |
37445
13.97%973
11.07%