Documentation/Device setup

For administrators

Bluetooth printing

Connect a printer, configure print_forms.xml and .prn templates, and use a ready-made order form.

PalmOrder for Android prints documents through a Bluetooth printer that accepts text over Bluetooth Classic SPP. The integrator prepares print_forms.xml and .prn templates, while the printer and character encoding are selected on the Android device.

Printer settings are available on devices with a FULL license. The license type is assigned during server pairing.

What to prepare

  • A printer that supports Bluetooth Classic SPP and text printing.
  • The printer manual describing supported encodings, character tables and characters per line.
  • Paper and a charged or powered printer.
  • Print form files for the required document.

Compatibility depends on the model's connection method, commands and encoding. Before using a custom form, print PalmOrder's built-in test page.

Connect the printer

  1. Turn on the printer and enable Bluetooth on the Android device.
  2. In Android Bluetooth settings, find and pair the printer. If a PIN is required, use the code from the printer manual.
  3. In PalmOrder, open Settings → Print → Printer.
  4. Tap select device and choose the printer. PalmOrder lists devices already paired with Android.
  5. If Android requests access to nearby devices, grant it to PalmOrder. On Android 12 and later, this permission is needed for Bluetooth connections. Android Bluetooth permissions.
  6. Set the character encoding to match the printer and tap Print test page.
  7. Check the text and language-specific characters, then save the printer settings.

Printer settings

SettingHow to use it
Print deviceThe selected paired Bluetooth printer. Select a new device when replacing the printer.
CharsetThe encoding of the bytes sent to the printer. The default is Cp1251. It must match the character table enabled on the printer itself.
Delay (ms)The pause after sending data before closing the stream. The default is 500. If the end of a document is missing, check the printer's settings and behavior and increase the delay if necessary.
Use insecure connectionAn alternative Bluetooth RFCOMM mode. Use it according to the printer's requirements if the normal connection does not work.

Save .prn templates as UTF-8. After substituting data, the app converts the resulting text to the encoding selected in the printer settings. Selecting Cp1251 in PalmOrder does not change the printer's character table.

For Cp866, the client uses a custom conversion, including replacing Ukrainian І/і with Latin I/i and Ґ/ґ with Г/г. To print these letters without substitutions, choose an encoding supported by the printer that includes them.

Ready-to-use 32-character example

Download the text order form archive. It contains:

FilePurpose
print_forms.xmlForm list containing “Order, 32 characters”.
order_32_en.prnA text template with products, pack factors and amounts.
exchange-profile.xmlA profile for downloading these files.
README.txtInstallation instructions and notes on the example's width and currency.

The form is designed for monospaced text with 32 characters per line. Long product names are truncated to 32 characters, and numeric values are aligned with spaces. Check the width on your printer and adjust the template if necessary.

Form list — print_forms.xml

<?xml version="1.0" encoding="utf-8"?>
<print-forms>
  <document name="order">
    <forms>
      <form lang="en">
        <presentation>Order, 32 characters</presentation>
        <file>order_32_en.prn</file>
      </form>
    </forms>
  </document>
</print-forms>

<document name="order"> identifies the document, and <form> defines one form. In <file>, use the exact template filename including its extension, without a directory path. For another document, use its name, such as invoice for a payment or storecheck for a store-check.

print_forms.xml defines the complete list of printer forms. To keep existing forms, merge the example's entry into your file and retain all other form entries.

The lang selection rules are the same as for PDF forms. Use en for English. If several forms are available for a document, the app offers a choice.

The .prn template

A .prn file contains plain text, line breaks and Chunk tags. Iterate over document lines using table:

{% loop in $table as $row %}
{$row.name|sprintf(%-32.32s)}
{$row.count|number|sprintf(%8s)} {$row.price|decimal|sprintf(%10s)} {$row.sum|decimal|sprintf(%12s)}
Pack factor: {$row.koef|number}
{% onEmpty %}
No products in this document
{% endloop %}

count is the entered quantity, koef is the number of base units in the selected pack, and price is the price per base unit. sum contains the line amount as calculated by the app.

The numeric row allocates 8, 10 and 12 characters plus two spaces between columns, totaling 32. The width in sprintf is a minimum, so very large numbers can exceed it. Check the form with quantities and amounts typical of your work.

Substitutions, conditions, filters and alignment are described in Template language — Chunk.

Printer commands

The escp protocol supports control sequences in .prn files. For example, {% escp.0A %} inserts a line-feed character with code 0A, and {% escp.esc E %} inserts ESC followed by the letter E.

The effect depends on your printer model's command set. Use codes from its manual and check the output on the printer. The archived example contains text with line breaks and uses the printer's current mode.

Transfer the form and print

  1. Extract the archive. If you already use print_forms.xml, merge the form entries.
  2. Place print_forms.xml and order_32_en.prn directly in the device's outbox.
  3. The Завантажити форми для друку profile in the standard exchange.xml already retrieves print_forms.xml and *.prn. Alternatively, add the profile from exchange-profile.xml inside <palm-client> in your exchange.xml.
  4. After changing exchange.xml, run Download exchange file. Then run the print form download profile and check the exchange log.
  5. Fill in the business details under Settings → Print → Business details.
  6. Open an order containing products and choose Print from the document menu. Select a form if several are available.
  7. Check language-specific characters, quantities, pack factors, prices, discount, total and the end of the printed document.

After updating a template, download the forms again and print. Physical printing must be checked for each printer model and mode.

If printing fails

SymptomWhat to check
Printer settings are unavailableThe device's FULL license.
The printer list is emptyBluetooth, Android pairing and PalmOrder's nearby-device permission.
Connection errorPower, distance, selected device, SPP support and whether the printer is connected to another phone.
The built-in test page prints, but the form is unavailableReceipt of print_forms.xml and .prn, the document name and the <form> entry.
Unexpected characters replace lettersPalmOrder's encoding and the printer's character table.
Columns shift or lines wrapCharacters per line, current font and long values in the template.
The end of the document is missingFinal line breaks, printer state and end delay.
Tags such as {$…} appear on paperField names and availability, conditions or fallback values for optional fields.