Appearance
Print Buffer Format Guide
1. Introduction The PrintBuffer format is a specialized text format used to generate receipts with specific formatting. This guide explains how to create correctly formatted PrintBuffer content that will render properly in the receipt system.
The PrintBuffer is transmitted within the additionalReceipts as BasicReceipt. By setting isPrimaryReceipt, the PrintBuffer will be used for PDF generation.
json
"additionalReceipts": [
{
"type": "BasicReceipt",
"contentType": "text/plain",
"isPrimaryReceipt": true,
"isPrintBuffer": true,
"content": "XHh7Q0VOVEVSfSBBQ01FIFNUT1JFClx4e0NFTlRFUn0gMTIzIE1haW4gU3RyZWV0Clx4e0NFTlRFUn0gQW55dG93biwgQU4gMTIzNDUKXHh7Q0VOVEVSfSBUZWw6IDU1NS0xMjMtNDU2NwpceHtDRU5URVJ9IC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQpDYXNoaWVyOiBKb2huICAgICAgICAgICAgIFJlZ2lzdGVyOiAwMQpEYXRlOiAyMDI1LTAzLTExICAgICAgICAgIFRpbWU6IDE1OjMwCgpSZWNlaXB0OiAjQTEyMzQ1Clx4e0NFTlRFUn0gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCjEgeCBQcm9kdWN0IEEgICAgICAgICAgICAgICAgICAgJDEwLjAwIAoyIHggUHJvZHVjdCBCICAgICAgICAgICAgICAgICAgICQxNS45MAozIHggUHJvZHVjdCBDICAgICAgICAgICAgICAgICAgICQyMC45NwoKXHh7UklHSFR9IFN1YnRvdGFsOiAgICAgICAgICAgICAgICAgICAkNDYuODcKXHh7UklHSFR9IFRheCAoMTAlKTogICAgICAgICAgICAgICAgICAkNC42OQpceHtSSUdIVH0gVE9UQUw6ICAgICAgICAgICAgICAgICAgICAgICQ1MS41NgpceHtDRU5URVJ9IC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQpceHtDRU5URVJ9IFRoYW5rIHlvdSBmb3Igc2hvcHBpbmcgd2l0aCB1cyEKXHh7UFRSX0JDU19RUkNPREV9IEExMjM0NS0yMDI1MDMxMQoKXHh7Q0VOVEVSfSBQb3dlcmVkIGJ5IEFueWJpbGw="
}
],2. Basic Syntax Each control character must be placed on its own line and begins with the \x{ prefix and ends with the } suffix. For example:
\x{CENTER}After a control character, the following line of text will be formatted according to that control character until the line ends. It’s only possible to use one control character per line.
3. Text Formatting Controls Use these control characters to change how text appears:
| Control Character | Effect |
|---|---|
\x{BOLD} | Makes text bold |
\x{DHIGH} | Makes text double height |
\x{DWIDE} | Makes text double width |
\x{DWIDEDHIGH} | Makes text both double height and width |
\x{SMALL} | Makes text smaller than normal |
4. Text Alignment Controls Use these control characters to change text alignment:
| Control Character | Effect |
|---|---|
\x{LEFT} | Aligns text to the left (default) |
\x{CENTER} | Centers text on the line |
\x{RIGHT} | Aligns text to the right |
\x{INVERSE} | Inverts the colors for the text (white text on black background) |
5. Barcode Controls Use these control characters to create different types of barcodes:
| Control Character | Effect |
|---|---|
\x{PTR_BCS_CODE39} | Creates a Code 39 barcode |
\x{PTR_BCS_CODE128A} | Creates a Code 128A barcode |
\x{PTR_BCS_CODE128B} | Creates a Code 128B barcode |
\x{PTR_BCS_CODE128C} | Creates a Code 128C barcode |
\x{PTR_BCS_QRCODE} | Creates a QR code |
6. QR Code Formatting For QR codes, additional control characters specify positioning and text placement:
| Control Character | Effect |
|---|---|
\x{PTR_BC_CENTER} | Centers the QR code (default) |
\x{PTR_BC_LEFT} | Left-aligns the QR code |
\x{PTR_BC_RIGHT} | Right-aligns the QR code |
\x{PTR_BC_TEXT_NONE} | Hides text with the QR code |
\x{PTR_BC_TEXT_ABOVE} | Shows text above the QR code |
\x{PTR_BC_TEXT_BELOW} | Shows text below the QR code |
7. Format Guidelines
Each receipt line has a maximum character limit:
- Maximum normal characters per line: 42
- Maximum small characters per line: 56
For alignment control:
- Left-aligned text is the default.
- Center and right-aligned text will be positioned based on the full line width.
- Text width varies based on the font - monospaced text works best for column alignment.
For barcodes and QR codes:
- Place the barcode/QR code content on the line after the control character.
- For QR codes, place positioning and text display preferences on separate lines.
8. Example Receipt Here’s an example of a basic receipt in PrintBuffer format:
\x{CENTER} ACME STORE
\x{CENTER} 123 Main Street
\x{CENTER} Anytown, AN 12345
\x{CENTER} Tel: 555-123-4567
\x{CENTER} ------------------------------
Cashier: John Register: 01
Date: 2025-03-11 Time: 15:30
Receipt: #A12345
\x{CENTER} ------------------------------
1 x Product A $10.00
2 x Product B $15.90
3 x Product C $20.97
\x{RIGHT} Subtotal: $46.87
\x{RIGHT} Tax (10%): $4.69
\x{RIGHT} TOTAL: $51.56
\x{CENTER} ------------------------------
\x{CENTER} Thank you for shopping with us!
\x{PTR_BCS_QRCODE} A12345-20250311
\x{CENTER} Powered by AnybillUsage of the print buffer
If this option will be used it is necessary to talk with us. There are configuration settings needed for every customer on the anybill side.