A JavaScript library that helps you create feature-rich PDF tables with column alignment, text wrapping, custom styling, and professional themes.
🎯 Column Alignment & Width Control
Control column widths, alignment, and constraints
columns: [
{ header: 'ID', dataKey: 'id', width: 50, align: 'center' },
{ header: 'Name', dataKey: 'name', minWidth: 80, align: 'left' },
{ header: 'Price', dataKey: 'price', align: 'right', headerAlign: 'center' },
{ header: 'Status', dataKey: 'status', width: '20%', align: 'center' }
]
📝 Text Wrapping
Automatic text wrapping for long content
columns: [
{ header: 'Title', dataKey: 'title', wrap: true, maxWidth: 120 },
{ header: 'Description', dataKey: 'desc', wrap: true, width: 200 }
]
🎨 Advanced Styling & Themes
Multiple themes and custom styling options
options: {
theme: 'minimal',
showBorders: true,
alternateRowColors: true,
headerStyles: { fontSize: 12, fontStyle: 'bold' },
bodyStyles: { fontSize: 10, lineHeight: 1.3 }
}
📐 Column Width Modes
Different algorithms for calculating column widths
// Auto: Scale to fit page width
// Content: Based on content size
// Equal: All columns same width
// Fixed: Use specified widths
🖼️ Custom Borders & Colors
Fine-grained border and color control
borderStyles: {
top: true, bottom: 2,
vertical: 0.5, horizontal: 1
},
headerStyles: {
fillColor: [52, 152, 219],
textColor: [255, 255, 255]
}
📄 Multi-page Tables
Automatic page breaks with header repetition
options: {
pageBreak: 'auto',
showHeader: true,
// Headers automatically repeat on new pages
}
📊 Table Positioning & Margins
Control table positioning and spacing
options: {
margin: { top: 20, left: 30, right: 20, bottom: 15 },
tableWidth: '80%',
startY: 50
}
🔧 Return Values & Chaining
Get table dimensions and position for further processing
const result = autoTable(doc, columns, data, options);
// Returns: { finalY, tableWidth, tableHeight, pageCount }