jspdf-autotable
- Version 5.0.2
- Published
- 236 kB
- No dependencies
- MIT license
Install
npm i jspdf-autotable
yarn add jspdf-autotable
pnpm add jspdf-autotable
Overview
Generate pdf tables with javascript (jsPDF plugin)
Index
Functions
Classes
Interfaces
UserOptions
- alternateRowStyles
- body
- bodyStyles
- columns
- columnStyles
- didDrawCell
- didDrawPage
- didParseCell
- foot
- footStyles
- head
- headStyles
- horizontalPageBreak
- horizontalPageBreakBehaviour
- horizontalPageBreakRepeat
- html
- includeHiddenHtml
- margin
- pageBreak
- rowPageBreak
- showFoot
- showHead
- startY
- styles
- tableId
- tableLineColor
- tableLineWidth
- tableWidth
- theme
- useCss
- willDrawCell
- willDrawPage
Type Aliases
- autoTableInstanceType
- CellHook
- CellInput
- CellWidthType
- Color
- ColumnInput
- ContentSettings
- CustomFontType
- FontStyle
- FontType
- HAlignType
- HorizontalPageBreakBehaviourType
- jsPDFConstructor
- jsPDFDocument
- MarginPadding
- MarginPaddingInput
- Opts
- OverflowType
- PageBreakType
- PageHook
- Pos
- RowInput
- RowPageBreakType
- Section
- ShowFootType
- ShowHeadType
- StandardFontType
- TableWidthType
- ThemeType
- VAlignType
Functions
function applyPlugin
applyPlugin: (jsPDF: jsPDFConstructor) => void;
function autoTable
autoTable: (d: jsPDFDocument, options: UserOptions) => void;
Classes
class Cell
class Cell {}
constructor
constructor(raw: CellInput, styles: Styles, section: Section);
property colSpan
colSpan: number;
property contentHeight
contentHeight: number;
property contentWidth
contentWidth: number;
property height
height: number;
property minReadableWidth
minReadableWidth: number;
property minWidth
minWidth: number;
property raw
raw: CellInput | HTMLTableCellElement;
property rowSpan
rowSpan: number;
property section
section: Section;
property styles
styles: Styles;
property text
text: string[];
property width
width: number;
property wrappedWidth
wrappedWidth: number;
property x
x: number;
property y
y: number;
method getContentHeight
getContentHeight: (scaleFactor: number, lineHeightFactor?: number) => number;
method getTextPos
getTextPos: () => Pos;
method padding
padding: ( name: 'vertical' | 'horizontal' | 'top' | 'bottom' | 'left' | 'right') => number;
class CellHookData
class CellHookData extends HookData {}
constructor
constructor( doc: DocHandler, table: Table, cell: Cell, row: Row, column: Column, cursor: Pos);
property cell
cell: Cell;
property column
column: Column;
property row
row: Row;
property section
section: 'head' | 'body' | 'foot';
class Column
class Column {}
constructor
constructor(dataKey: string | number, raw: ColumnInput, index: number);
property dataKey
dataKey: string | number;
property index
index: number;
property minReadableWidth
minReadableWidth: number;
property minWidth
minWidth: number;
property raw
raw: ColumnInput;
property width
width: number;
property wrappedWidth
wrappedWidth: number;
method getMaxCustomCellWidth
getMaxCustomCellWidth: (table: Table) => number;
class HookData
class HookData {}
constructor
constructor(doc: DocHandler, table: Table, cursor: Pos);
property cursor
cursor: Pos;
property doc
doc: any;
property pageNumber
pageNumber: number;
property settings
settings: Settings;
property table
table: Table;
class Row
class Row {}
constructor
constructor( raw: RowInput | HTMLTableRowElement, index: number, section: Section, cells: { [key: string]: Cell }, spansMultiplePages?: boolean);
property cells
readonly cells: { [key: string]: Cell };
property element
readonly element?: HTMLTableRowElement;
property height
height: number;
property index
readonly index: number;
property raw
readonly raw: RowInput | HTMLTableRowElement;
property section
readonly section: Section;
property spansMultiplePages
spansMultiplePages: boolean;
method canEntireRowFit
canEntireRowFit: (height: number, columns: Column[]) => boolean;
method getMaxCellHeight
getMaxCellHeight: (columns: Column[]) => number;
method getMinimumRowHeight
getMinimumRowHeight: (columns: Column[], doc: DocHandler) => number;
method hasRowSpan
hasRowSpan: (columns: Column[]) => boolean;
class Table
class Table {}
constructor
constructor(input: TableInput, content: ContentSettings);
property body
readonly body: Row[];
property columns
readonly columns: Column[];
property finalY
finalY?: number;
property foot
readonly foot: Row[];
property head
readonly head: Row[];
property hooks
readonly hooks: HookProps;
property id
readonly id?: string | number;
property pageNumber
pageNumber: number;
property settings
readonly settings: Settings;
property startPageNumber
startPageNumber?: number;
property styles
readonly styles: StylesProps;
method allRows
allRows: () => Row[];
method callCellHooks
callCellHooks: ( doc: DocHandler, handlers: CellHook[], cell: Cell, row: Row, column: Column, cursor: { x: number; y: number } | null) => boolean;
method callEndPageHooks
callEndPageHooks: (doc: DocHandler, cursor: { x: number; y: number }) => void;
method callWillDrawPageHooks
callWillDrawPageHooks: ( doc: DocHandler, cursor: { x: number; y: number }) => void;
method getFootHeight
getFootHeight: (columns: Column[]) => number;
method getHeadHeight
getHeadHeight: (columns: Column[]) => number;
method getWidth
getWidth: (pageWidth: number) => number;
Interfaces
interface CellDef
interface CellDef {}
interface ContentInput
interface ContentInput {}
interface HookProps
interface HookProps {}
property didDrawCell
didDrawCell: CellHook[];
property didDrawPage
didDrawPage: PageHook[];
property didParseCell
didParseCell: CellHook[];
property willDrawCell
willDrawCell: CellHook[];
property willDrawPage
willDrawPage: PageHook[];
interface LineWidths
interface LineWidths {}
interface Settings
interface Settings {}
property horizontalPageBreak
horizontalPageBreak?: boolean;
property horizontalPageBreakBehaviour
horizontalPageBreakBehaviour?: 'immediately' | 'afterAllRows';
property horizontalPageBreakRepeat
horizontalPageBreakRepeat?: string | number | string[] | number[] | null;
property includeHiddenHtml
includeHiddenHtml: boolean;
property margin
margin: MarginPadding;
property pageBreak
pageBreak: 'auto' | 'avoid' | 'always';
property rowPageBreak
rowPageBreak: 'auto' | 'avoid';
property showFoot
showFoot: 'everyPage' | 'lastPage' | 'never';
property showHead
showHead: 'everyPage' | 'firstPage' | 'never';
property startY
startY: number;
property tableLineColor
tableLineColor: Color;
property tableLineWidth
tableLineWidth: number;
property tableWidth
tableWidth: 'auto' | 'wrap' | number;
property theme
theme: 'striped' | 'grid' | 'plain';
property useCss
useCss: boolean;
interface Styles
interface Styles {}
property cellPadding
cellPadding: MarginPaddingInput;
property cellWidth
cellWidth: CellWidthType;
property fillColor
fillColor: Color;
property font
font: FontType;
property fontSize
fontSize: number;
property fontStyle
fontStyle: FontStyle;
property halign
halign: HAlignType;
property lineColor
lineColor: Color;
property lineWidth
lineWidth: number | Partial<LineWidths>;
property minCellHeight
minCellHeight: number;
property minCellWidth
minCellWidth: number;
property overflow
overflow: OverflowType;
property textColor
textColor: Color;
property valign
valign: VAlignType;
interface StylesProps
interface StylesProps {}
property alternateRowStyles
alternateRowStyles: Partial<Styles>;
property bodyStyles
bodyStyles: Partial<Styles>;
property columnStyles
columnStyles: { [key: string]: Partial<Styles>;};
property footStyles
footStyles: Partial<Styles>;
property headStyles
headStyles: Partial<Styles>;
property styles
styles: Partial<Styles>;
interface TableInput
interface TableInput {}
interface UserOptions
interface UserOptions {}
property alternateRowStyles
alternateRowStyles?: Partial<Styles>;
property body
body?: RowInput[];
property bodyStyles
bodyStyles?: Partial<Styles>;
property columns
columns?: ColumnInput[];
property columnStyles
columnStyles?: { [key: string]: Partial<Styles>;};
property didDrawCell
didDrawCell?: CellHook;
Called after a cell has been added to the page. Can be used to draw additional cell content such as images with
doc.addImage
, additional text withdoc.addText
or other jspdf shapes.
property didDrawPage
didDrawPage?: PageHook;
Called after the plugin has finished drawing everything on a page. Can be used to add footers with page numbers or any other content that you want on each page there is an autotable.
property didParseCell
didParseCell?: CellHook;
Called when the plugin finished parsing cell content. Can be used to override content or styles for a specific cell.
property foot
foot?: RowInput[];
property footStyles
footStyles?: Partial<Styles>;
property head
head?: RowInput[];
property headStyles
headStyles?: Partial<Styles>;
property horizontalPageBreak
horizontalPageBreak?: boolean;
property horizontalPageBreakBehaviour
horizontalPageBreakBehaviour?: HorizontalPageBreakBehaviourType;
property horizontalPageBreakRepeat
horizontalPageBreakRepeat?: string[] | number[] | string | number;
property html
html?: string | HTMLTableElement;
property includeHiddenHtml
includeHiddenHtml?: boolean;
property margin
margin?: MarginPaddingInput;
property pageBreak
pageBreak?: PageBreakType;
property rowPageBreak
rowPageBreak?: RowPageBreakType;
property showFoot
showFoot?: ShowFootType;
property showHead
showHead?: ShowHeadType;
property startY
startY?: number | false;
property styles
styles?: Partial<Styles>;
property tableId
tableId?: string | number;
property tableLineColor
tableLineColor?: Color;
property tableLineWidth
tableLineWidth?: number;
property tableWidth
tableWidth?: TableWidthType;
property theme
theme?: ThemeType;
property useCss
useCss?: boolean;
property willDrawCell
willDrawCell?: CellHook;
Called before a cell or row is drawn. Can be used to call native jspdf styling functions such as
doc.setTextColor
or change position of text etc before it is drawn.
property willDrawPage
willDrawPage?: PageHook;
Called before starting to draw on a page. Can be used to add headers or any other content that you want on each page there is an autotable.
Type Aliases
type autoTableInstanceType
type autoTableInstanceType = (options: UserOptions) => void;
type CellHook
type CellHook = (data: CellHookData) => void | boolean;
type CellInput
type CellInput = null | string | string[] | number | boolean | CellDef;
type CellWidthType
type CellWidthType = 'auto' | 'wrap' | number;
type Color
type Color = [number, number, number] | number | string | false;
type ColumnInput
type ColumnInput = | string | number | { header?: CellInput; footer?: CellInput; dataKey?: string | number; };
type ContentSettings
type ContentSettings = { body: Row[]; head: Row[]; foot: Row[]; columns: Column[];};
type CustomFontType
type CustomFontType = string;
type FontStyle
type FontStyle = 'normal' | 'bold' | 'italic' | 'bolditalic';
type FontType
type FontType = StandardFontType | CustomFontType;
type HAlignType
type HAlignType = 'left' | 'center' | 'right' | 'justify';
type HorizontalPageBreakBehaviourType
type HorizontalPageBreakBehaviourType = 'immediately' | 'afterAllRows';
type jsPDFConstructor
type jsPDFConstructor = any;
type jsPDFDocument
type jsPDFDocument = any;
type MarginPadding
type MarginPadding = { top: number; right: number; bottom: number; left: number;};
type MarginPaddingInput
type MarginPaddingInput = | number | number[] | { top?: number; right?: number; bottom?: number; left?: number; horizontal?: number; vertical?: number; };
type Opts
type Opts = { [key: string]: string | number;};
type OverflowType
type OverflowType = | 'linebreak' | 'ellipsize' | 'visible' | 'hidden' | ((text: string | string[], width: number) => string | string[]);
type PageBreakType
type PageBreakType = 'auto' | 'avoid' | 'always';
type PageHook
type PageHook = (data: HookData) => void | boolean;
type Pos
type Pos = { x: number; y: number;};
type RowInput
type RowInput = | { [key: string]: CellInput; } | HtmlRowInput | CellInput[];
type RowPageBreakType
type RowPageBreakType = 'auto' | 'avoid';
type Section
type Section = 'head' | 'body' | 'foot';
type ShowFootType
type ShowFootType = 'everyPage' | 'lastPage' | 'never' | boolean;
type ShowHeadType
type ShowHeadType = 'everyPage' | 'firstPage' | 'never' | boolean;
type StandardFontType
type StandardFontType = 'helvetica' | 'times' | 'courier';
type TableWidthType
type TableWidthType = 'auto' | 'wrap' | number;
type ThemeType
type ThemeType = 'striped' | 'grid' | 'plain' | null;
type VAlignType
type VAlignType = 'top' | 'middle' | 'bottom';
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (23)
- @eslint/eslintrc
- @eslint/js
- @rollup/plugin-typescript
- @types/mocha
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- dts-bundle-generator
- eslint
- eslint-config-prettier
- eslint-plugin-prettier
- jsdom
- jspdf
- mocha
- npm-check-updates
- prettier
- rollup
- ts-loader
- ts-node
- tslib
- typescript
- webpack
- webpack-cli
- webpack-dev-server
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/jspdf-autotable
.
- Markdown[](https://www.jsdocs.io/package/jspdf-autotable)
- HTML<a href="https://www.jsdocs.io/package/jspdf-autotable"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4045 ms. - Missing or incorrect documentation? Open an issue for this package.