Skip to main content

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:

typeTypical encodingPrints on
pdfurl or base64Office printers (A4, Letter); thermal printers (each page rasterized to the paper width, up to 50 pages)
imageurl or base64 (PNG, JPEG)Office printers (as is); thermal printers (1-bit raster, scale fit or actual)
textutf8Thermal printers (wrapped, converted to the codepage); office printers (as a generated PDF)
htmlutf8 or urlPrinted through a headless Chrome, Edge or Chromium converted to PDF. Only on agents where such a browser is installed (capability html).
rawbase64Any printer: bytes are sent unchanged
escposbase64Thermal printers; must start with an ESC/POS command. cut and openDrawer options are appended.
zpl, eplutf8 or base64Label 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​

OptionValues
copies1 or more. Office printers print the copies in one spooler job.
papera4, letter, 58mm, 80mm, label-4x6, label-2x1
orientationportrait, landscape
duplexnone, long, short
colortrue or false
pageRangefor example 1-3 or 1,3,5-7
trayauto or a tray name the driver knows
scalefit 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.