PDFs and documents
Besides receipts, a job can carry a PDF, an image, plain text, HTML, raw printer bytes, ESC/POS, ZPL or EPL. Set type and encoding:
type | Typical encoding | Prints on |
|---|---|---|
pdf | url or base64 | Office printers (A4, Letter); thermal printers (each page rasterized to the paper width, up to 50 pages) |
image | url or base64 (PNG, JPEG) | Office printers (as is); thermal printers (1-bit raster, scale fit or actual) |
text | utf8 | Thermal printers (wrapped, converted to the codepage); office printers (as a generated PDF) |
html | utf8 or url | Printed through a headless Chrome, Edge or Chromium converted to PDF. Only on agents where such a browser is installed (capability html). |
raw | base64 | Any printer: bytes are sent unchanged |
escpos | base64 | Thermal printers; must start with an ESC/POS command. cut and openDrawer options are appended. |
zpl, epl | utf8 or base64 | Label printers. See Labels and templates. |
With encoding: "url", data is an https:// URL that the agent downloads (60 seconds and 50 MB at most). Use a short-lived signed URL for private documents.
Example
await jp.print({
printer: { alias: "office" },
type: "pdf",
encoding: "url",
data: "https://files.example.com/invoices/10492.pdf?sig=…",
options: { copies: 2, duplex: "long", paper: "a4", pageRange: "1-3", color: false },
});
Document options
| Option | Values |
|---|---|
copies | 1 or more. Office printers print the copies in one spooler job. |
paper | a4, letter, 58mm, 80mm, label-4x6, label-2x1 |
orientation | portrait, landscape |
duplex | none, long, short |
color | true or false |
pageRange | for example 1-3 or 1,3,5-7 |
tray | auto or a tray name the driver knows |
scale | fit or actual |
How each system prints documents
- Windows: through the Windows spooler, with the bundled PDF helper for PDF files.
- macOS and Linux: through CUPS.
- Android: PDFs are rasterized for thermal and built-in printers; office printers are not supported.
Check the agent's capabilities (pdf, image, html…) from agent.info before offering a format. The browser SDK does this for you and throws UNSUPPORTED_FORMAT before sending.
Images and PDFs on label printers are not supported yet: send ZPL or EPL instead.