Define Print Data types
masterThe data array passed to PosPrinter.print consists of objects with a type property. Supported types include:
text: Renders plain text. Supports astyleobject for CSS-like styling (e.g.,fontSize,textAlign,color).image: Renders an image viaurlorpath. Supportsposition('left' | 'center' | 'right'),width, andheight.barCode: Renders a barcode. Supportsvalue,height,width,displayValue(boolean), andfontsize.qrCode: Renders a QR code. Supportsvalue,height,width, andstyle.table: Renders a structured table. SupportstableHeader,tableBody,tableFooter(which can be arrays of strings or arrays of complex objects liketextorimage), and specific styling for each section (tableHeaderStyle,tableBodyStyle,tableFooterStyle).
// Example of various data types
const data = [
{ type: 'image', url: '...', position: 'center', width: '160px', height: '60px' },
{ type: 'text', value: 'TITLE', style: { fontWeight: '700', textAlign: 'center' } },
{ type: 'barCode', value: '12345', height: 40, width: 2, displayValue: true },
{ type: 'qrCode', value: 'https://...', height: 55, width: 55 },
{
type: 'table',
tableHeader: ['Col1', 'Col2'],
tableBody: [['Val1', 'Val2']],
style: { border: '1px solid #ddd' }
}
];