Printing at the Point of Sale
Point-of-sale (POS) printing is different from ordinary printing. A receipt has to print quickly when a sale is done, while the customer waits at the counter. POS printers are also special: they have settings and features that office printers don't have. This page explains how to set up direct print for POS and how to choose between PDF-based ForNAV reports and the printer's native language.
Client-print vs. service-print at the POS
Both client-print and service-print can print receipts. If your POS terminals are Windows computers, client-print is usually the better choice.
Important
Client-print requires that the user runs Business Central in a browser on a Windows computer, because the client-print program is installed on that computer. If your POS runs on tablets, phones, or other devices that don't run Windows, use service-print. Printing without a user interface
Quick printing
With service-print, the job goes into the print queue in Business Central and waits until the direct print service picks it up. The service finds new jobs by polling the queue or the signal hub, which adds a delay before printing starts. You can make the delay shorter, but it never goes away.
With client-print, the job is downloaded to the POS terminal and printed from there. There is still a small delay while the file is downloaded and the client-print program handles it, but the job doesn't wait in a queue, nothing has to poll for it, and no central server sits between the cashier and the printer. This makes client-print quick.
The printer runs in the user's context
Client-print runs in the logged-in user's context, the same way Notepad or Microsoft Word does. It uses the printer exactly as it's set up for the user at the POS terminal. To change a setting, the user opens the printer properties in Windows on that terminal, and the next receipt uses it.
Service-print runs as the service user, often on another machine. To check or change printer properties, you have to log in to the server as the service user, and the printer may be set up differently there. Read more on user context
This matters more at the POS than anywhere else, because POS printers can be hard to work with. They often have many special settings, such as paper width, roll length, paper feed and cutting after the job, print density and speed, cash drawer settings, and emulation modes. Some drivers also remember settings from the previous job (see Label printers). When the settings live in the same user context as the cashier, the problems are much easier to find and fix.
Set up the terminal for fast printing
To make client-print at the POS as fast and hands-free as possible:
- Install the client-print client on every POS terminal. Each terminal must be a Windows computer. Client-print installation
- Create a direct printer that doesn't queue jobs, so the job downloads to the terminal at once. Define a direct printer
- Tell the browser to always open .fornavprint files, so the cashier doesn't have to click the download. Open .fornavprint file automatically
- Turn on stay in memory (described below).
Stay in memory
By default, Windows starts the client-print program for every print job, and the program exits when the job is done. Starting the program takes time, and at a busy counter that time adds up with every receipt.
Turn on stay in memory, and the client-print program stays loaded after the first job and waits for the next one. While it's loaded, it watches the folder where the first .fornavprint file was downloaded. When a new file appears there, the program prints it quickly, without starting up again.
You configure this in client.json:
C:\ProgramData\ForNAV\Direct Print\Configuration\client.json
{
"IdleTimeOut": 600,
"StayInMemory": true
}
- StayInMemory: Set to
trueto keep the program loaded after a job. - IdleTimeOut: How many seconds the program stays loaded after the last job. At a POS that's open all day, you may want a longer timeout so the program is still loaded when the next customer arrives after a quiet period.
PDF-based ForNAV reports vs. the printer's native language
You can produce a receipt in two ways:
- PDF-based printing: Design the receipt as a ForNAV report. Direct print renders it as a PDF and sends it to the Windows printer driver. The driver then translates it into the printer's own language.
- Native language (raw) printing: Your AL code builds the commands in the printer's native language, such as ZPL for Zebra label printers or ESC/POS for many receipt printers. Direct print sends them to the printer as a raw job, without the driver. Printing Zebra ZPL or raw data
PDF-based printing
Pros
- You design the receipt in the ForNAV Designer, like any other report, and you see what you get.
- Logos, images, fonts, barcodes, and multiple languages work the same way as in your other ForNAV reports.
- It's easy to maintain. Changing the layout doesn't require AL code.
- It works with any printer that has a Windows driver, so you can replace the printer with another make or model without changing the report.
- You can preview the receipt and archive it as a PDF.
Cons
- It's slower. The report has to be rendered as a PDF, and the driver has to translate the PDF into the printer's language. On slow POS hardware, you can notice this.
- You can only use the features the driver offers. Features like cutting the paper, opening the cash drawer, or printing a logo stored in the printer may be hidden behind driver settings, or they may not be available at all.
- The printer driver's settings control the result. Paper size and roll length have to match exactly, or the printer may cut in the wrong place, print extra paper, or reject the job. Paper size
Native language printing
Pros
- You control everything the printer can do: cutting the paper (full or partial), opening the cash drawer, printing logos stored in the printer, built-in barcode and QR code commands, print density, and so on.
- It's fast. A raw job is a small text or binary stream. Nothing has to be rendered as a PDF, and no driver has to translate it. At the POS, speed is often the most important thing.
- The result doesn't depend on the driver's settings in the user's Windows profile, so all terminals print the same way.
Cons
- You build the output in AL code, not in a visual designer, so changing the layout means changing code.
- The commands work only with one printer language. If you replace the printer with one that speaks a different language, you have to rewrite the output.
- You can't easily preview the receipt or archive it as a document.
- You have to learn the printer's command set.
What should I choose?
Use a PDF-based ForNAV report when the receipt has a rich layout, has to look the same as your other documents, or has to print on different printers. Use the native language when speed matters most or you need features that only the printer's own commands give you, such as cutting the paper or opening the cash drawer.
Raw jobs with client-print
Raw jobs aren't only for service-print. If you create a raw job with "ForNAV DirPrt Queue".Create on a client-print direct printer (one that doesn't queue jobs and has the initial status Ready), the job is downloaded to the terminal right away and printed by the client-print program.
// Send the receipt commands to the POS terminal's client printer
DirPrtQueue.Create('Receipt', 'POS Receipt Printer', receiptInStream, DirPrtQueue.ContentType::Zebra);
Despite its name, the Zebra content type means "raw job". It works with any printer that accepts raw data, not only Zebra printers. If your printer has several driver types to choose from, make sure you use one that passes raw data through to the printer. Driver types
Raw printing, client-print, and stay in memory together give you a fast POS setup that you control completely.
See also
Service-print vs. Client-print Client-print Printing Zebra ZPL or raw data Label printers User context Performance