Skip to content
Taprel
Docs menu PDFs

PDFs and raw printing

Print PDFs through the Windows driver, or send your own printer commands.

PDFs

printPdf prints on any printer with a Windows driver. It needs the printer’s exact name, from listPrinters():

const pdf = await (await fetch("/invoice.pdf")).blob();

await printer.printPdf("Office printer", pdf, { copies: 2 });

Every option is optional:

Option Values What it does
copies 1 to 100, default 1 Repeats the whole document in the same job, in order
scale "fit" (default) or "actual" fit makes each page as large as it can be without changing its shape. actual keeps the real size, and cuts what falls outside the printable area
paper { widthMm, heightMm }, 10 to 1000 mm Replaces the driver’s paper size for this job. If the driver refuses it, the job fails with PRINT_FAILED, saying so

A file that isn’t a PDF gives BAD_REQUEST. In React and Vue, usePrint() gives the same call as printPdf.

Raw printing

printRaw sends your bytes unchanged, so they must be in the printer’s own language, like ESC/POS, TSPL or ZPL. Most apps should use receipts and labels instead, which Taprel turns into each printer’s language for you.

await printer.printRaw("Front desk receipt", bytes);

For both calls, the data is a Uint8Array, ArrayBuffer, Blob, or a string already in base64.