ESC/POS vs PDF: Which Is Better for Receipt Printing?
Choose between ESC/POS and PDF for thermal receipts based on speed, layout, hardware control, and printer compatibility. Then test either approach through the same cloud printing API.
By the PrintScaler team · · 10 min read
For a compatible thermal receipt printer, ESC/POS is usually the better choice for fast text receipts, sharp native text, and commands such as paper cutting or opening a cash drawer. PDF is often the better choice when your application already generates designed documents or must print the same document on different kinds of printers. The right choice depends on the printer, the document, and how much hardware-specific behavior your application needs.
This ESC/POS vs PDF comparison explains those tradeoffs and shows how to test both formats through PrintScaler without putting printer credentials or API keys in your browser application.
ESC/POS vs PDF: the practical comparison
ESC/POS is a command language used by many thermal receipt printers. Your application sends bytes describing text, alignment, formatting, images, and supported printer actions.
PDF is a page-description format. Your application supplies a finished document, and the printing system renders it for the selected printer.
Neither format connects a cloud application to a shop-floor printer by itself. You still need a delivery path, such as a local printing agent or a supported direct printer connection.
| Decision | ESC/POS | |
|---|---|---|
| Best fit | Transaction receipts and operational tickets | Designed receipts, invoices, and document layouts |
| Typical layout model | A stream of text and printer commands | Pages with defined dimensions |
| Text printing | Uses printer-native text when supported | Uses the PDF rendering and driver path |
| Speed | Usually faster for straightforward thermal receipts | Can involve more rendering work |
| Cut and drawer commands | Available through supported printer commands | Not encoded as standard PDF document actions |
| Fonts and branding | Depends on printer features and image handling | More control over document typography and design |
| Hardware portability | Requires checking command and encoding support | Often easier across printers with working PDF print paths |
| Digital copy | Usually needs a separate customer-facing representation | Can serve as both a downloadable receipt and print document |
A useful default: choose ESC/POS for a dedicated checkout receipt printer. Choose PDF when consistent document design and reuse matter more than direct hardware control.
When ESC/POS is the better receipt format
Your receipt is mostly text
An ordinary receipt contains a business name, transaction details, items, totals, and a short footer. That structure maps naturally to a thermal printer’s text capabilities.
With ESC/POS, the printer can produce supported native characters without first rendering an entire PDF page. For straightforward receipts, this path is faster and sharper than PDF printing.
That advantage becomes less predictable when every receipt is a large raster image. If you convert the whole receipt into a bitmap and send that bitmap through ESC/POS, you are no longer benefiting from native text in the same way.
You need a cutter or cash drawer
Receipt workflows often include actions beyond putting text on paper:
- Feed enough paper for the customer to grasp the receipt.
- Cut the receipt at the end of a transaction.
- Pulse a compatible cash drawer connected through the printer.
- Print a supported barcode or QR code.
ESC/POS can express these actions, but support is model-specific. A cutter command cannot add a cutter to hardware that lacks one, and drawer commands must match the printer and connected equipment.
Do not treat every printer advertised as ESC/POS-compatible as identical. Confirm the supported command set in the manufacturer’s programming documentation.
You print variable-length receipts
A two-item sale and a forty-item sale should not necessarily occupy the same fixed-height page.
ESC/POS works naturally as a stream: print the header, print each item, print the total, feed, and optionally cut. You do not have to calculate a PDF page height for every transaction.
You still need layout rules. Long product descriptions must wrap, monetary values need alignment, and the application must know its usable line width.
When PDF is the better choice
Your application already generates the receipt as a PDF
If your system already creates a customer-facing PDF receipt, printing that document can avoid maintaining a second rendering implementation.
This is useful when receipts include detailed tax information, long addresses, structured tables, or a carefully designed brand layout. The same PDF can be downloaded by the customer and submitted for printing.
However, design the document for its actual destination. An A4 receipt reduced to a narrow thermal roll usually produces tiny text and wasted space. A receipt PDF should use page dimensions appropriate to the target paper and printer.
You need more control over typography
PDF makes it easier to compose proportional text, multiple font sizes, vector elements, and precise positioning in one document.
That does not eliminate printer limitations. A thermal printer still has a fixed printable width and resolution. Small light-gray text that looks attractive on a monitor may be difficult to read on receipt paper.
Use embedded fonts where appropriate, high-contrast elements, and a physical print test. A correct screen preview is not proof that a receipt is readable at the counter.
The destination is not always a receipt printer
Some workflows print a short receipt on a thermal device and a detailed invoice on a desktop printer. PDF is often easier to reuse across those destinations, assuming each machine has the necessary printer setup.
PDF is also a practical fallback when a device has a working operating-system print path but does not accept the ESC/POS commands your application generates.
That fallback still needs testing. Driver support, paper definitions, margins, and scaling can affect the result.
Paper width is not the same as printable width
A common mistake in both formats is treating an 80 mm or 58 mm roll width as the space available for content.
The printer’s printable area may be narrower. For ESC/POS, the number of characters that fit also depends on the selected font and text size. For PDF, the document size, driver configuration, and scaling determine where content lands.
Before implementing layout, establish a small printer profile containing:
- Printer model and connection method.
- Paper width and documented printable width.
- For ESC/POS, supported encoding and tested characters per line.
- For PDF, the installed paper definition and verified scaling behavior.
- Whether cutting and drawer control are required and supported.
Do not assume that all 80 mm printers accept the same line length. Test a line near the right edge, a long item name, and a total with several digits.
For PDF, avoid shrinking content merely to make the job finish without clipping. Fix the document dimensions and printer configuration first.
Test ESC/POS and PDF with PrintScaler
PrintScaler accepts both PDF documents and RAW printer data through the same HTTPS endpoint. Your application selects the format using contentType; the service delivers the job to the selected printer.
PrintScaler does not turn an arbitrary PDF into a semantic ESC/POS receipt. Your application supplies either a PDF or printer-ready RAW bytes.
1. Connect the receipt printer
Start by confirming that the printer works from the computer connected to it. Then install the PrintScaler agent on that computer and enter the dashboard pairing code.
The agent runs on Windows, macOS, Linux, and Raspberry Pi. It starts after reboots, updates itself, and communicates outbound, so you do not need to expose a printer port through the router.
In the dashboard, locate the printer and note its printer ID. Use the test-page button to check the basic printing path, then test the actual receipt format you intend to use.
For RAW printing, confirm that the selected device accepts ESC/POS. A successful PDF test does not establish that an arbitrary printer supports ESC/POS commands.
2. Send a minimal ESC/POS receipt
The following Python example uses only the standard library. It sends a short ASCII receipt using raw_base64 and authenticates with a bearer API key.
Set PRINTSCALER_API_KEY and PRINTSCALER_PRINTER_ID in your server environment before running it.
import base64
import json
import os
import urllib.request
printer_id = int(os.environ["PRINTSCALER_PRINTER_ID"])
api_key = os.environ["PRINTSCALER_API_KEY"]
# Common ESC/POS initialize command, followed by ASCII text.
# Verify command support for your printer model.
receipt = b"\x1b@" + (
"CORNER SHOP\n"
"Receipt: TEST-1042\n"
"------------------------------\n"
"Coffee 3.50\n"
"Sandwich 7.00\n"
"TOTAL 10.50\n"
"\nThank you!\n\n\n"
).encode("ascii")
payload = {
"printerId": printer_id,
"contentType": "raw_base64",
"content": base64.b64encode(receipt).decode("ascii"),
"title": "ESC/POS receipt test TEST-1042"
}
request = urllib.request.Request(
"https://api.printscaler.com/v1/printjobs",
data=json.dumps(payload).encode("utf-8"),
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
"X-Idempotency-Key": "receipt-test-1042-escpos-v1"
},
method="POST"
)
with urllib.request.urlopen(request, timeout=30) as response:
print(response.status)
print(response.read().decode("utf-8"))
This example deliberately omits cutter and cash-drawer commands. Add those only after checking the device’s command reference and testing in a controlled environment. See the ESC/POS receipt printing documentation for the PrintScaler delivery path.
If you prefer JavaScript, the related Node.js ESC/POS printing guide covers that implementation approach.
3. Send a receipt-sized PDF
Create a PDF with dimensions appropriate to your receipt printer. Then submit it using pdf_uri, replacing the example URL with a PDF URL accessible to PrintScaler:
curl --request POST \
'https://api.printscaler.com/v1/printjobs' \
--header "Authorization: Bearer $PRINTSCALER_API_KEY" \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: receipt-test-1042-pdf-v1' \
--data '{
"printerId": 123,
"contentType": "pdf_uri",
"content": "https://files.example.com/receipts/test-1042.pdf",
"title": "PDF receipt test TEST-1042"
}'
Replace 123 with your actual printer ID. These are two separate comparison jobs, so running both examples intentionally prints two receipts.
If a receipt should not be hosted at a retrievable URL, you can submit its base64-encoded PDF bytes with pdf_base64 instead. Base64 is an encoding, not encryption; keep receipt data and API credentials protected.
PrintScaler supports PDF options including paper size, DPI, rotation, and fit to page. Read the printer’s available capabilities and consult the print options reference rather than guessing paper names or option values.
4. Compare the physical output
Print the same representative transaction in both formats and evaluate:
- Time from submission to a usable receipt.
- Readability of small text and totals.
- Long item names and unusually large amounts.
- Accented characters and any required non-Latin scripts.
- QR-code or barcode scanning, if used.
- Paper consumed after the final line.
- Supported cutter behavior, tested separately.
Use your real printer model, driver, and connection. A preview or a test on another device cannot settle the decision for your production setup.
Reliability matters more than the document format
A well-formatted receipt is still a failed workflow if it prints twice or reaches the wrong checkout.
Keep print requests on the server
Your browser or tablet should tell your backend that a receipt needs printing. The backend should authorize that action, select the correct printer, and submit the request.
Do not expose a PrintScaler API key in frontend JavaScript. Do not trust a browser-supplied printer ID without checking that the user is allowed to print there.
Give each intended receipt a stable identity
Use an X-Idempotency-Key tied to the intended print operation. If a request times out, retry that same operation with the same key rather than generating a new one.
An intentional customer reprint is a different operation and should receive a new identity. Record that distinction in your application so staff can tell an automatic retry from an approved reprint.
Track jobs beyond the HTTP response
API acceptance and physical paper output are different events. PrintScaler exposes job states and history, including new, queued, in_progress, done, and error-related outcomes.
Use state tracking or signed webhooks to update your application, and interpret completion in the context of what the printing path can report. Do not present an accepted request as proof that a customer is holding the receipt.
Jobs can queue while the computer is offline and print when it reconnects, subject to their configured expiration. Choose an expiration policy appropriate to receipts: an old checkout ticket appearing much later may confuse staff. The job states documentation explains the available lifecycle states.
Can you print receipts without a computer?
Yes, with supported hardware. Certain Epson receipt printers support Server Direct Print and can connect to PrintScaler directly, without an agent computer.
Examples include the TM-m30III, supported TM-m30II variants, TM-m50/II, and TM-T88VI/VII. Verify the exact model and configuration before purchasing or deploying equipment.
This is a connection decision, separate from your receipt-format decision. Do not assume that a supported direct connection makes every document format or printer command interchangeable. The related guide to printing receipts from an iPad without a PC explains that deployment approach.
Choose one primary format, then document exceptions
For most dedicated checkout systems, start with ESC/POS. It fits variable-length receipts, supports printer-native text, and gives you access to supported receipt hardware commands.
For document-oriented workflows, start with PDF. It is a practical choice when you already generate customer PDFs, need detailed page composition, or print across different printer categories.
You can support both, but two renderers mean two implementations to maintain and test. Make that investment because your workflow requires it, not because the API accepts both formats.
PrintScaler charges per print request rather than per page; compare deployment needs against the current plans. Then create a free account, connect one printer, and test the same receipt in both formats before committing your production workflow.
Frequently asked questions
Is ESC/POS faster than PDF for receipt printing?
For straightforward receipts using printer-native text, ESC/POS is generally faster and sharper than PDF. The difference depends on the printer, connection, PDF rendering path, and whether the ESC/POS job contains native text or large raster images.
Can a thermal receipt printer print a PDF?
Many thermal receipt printers can print PDFs through an appropriate operating-system driver and printing path. The PDF must use suitable dimensions, and paper size and scaling settings need testing. ESC/POS support alone does not mean the printer can interpret PDF bytes directly.
Does ESC/POS work with every receipt printer?
No. Confirm that the exact printer model supports ESC/POS and check its supported commands, character encodings, and hardware features. Compatible models can still differ in cutter commands, image handling, QR-code support, and available fonts.
Can a PDF receipt open a cash drawer or cut the paper?
A PDF document does not itself encode standard cash-drawer or cutter commands. Some printer drivers provide device-specific behavior around a print job, but you should not assume that configuration exists. Supported ESC/POS commands provide a more explicit way to request those actions.
Can PrintScaler send both ESC/POS and PDF receipts?
Yes. Use pdf_uri or pdf_base64 for PDFs, and raw_uri or raw_base64 for printer-ready ESC/POS bytes. Both use the same printjobs endpoint, but your application must generate the chosen format and select a compatible printer.