Dot Matrix Printing for Inward Deposit and Payment Receipts - hmislk/hmis GitHub Wiki
Coop and other sites print inward deposit and payment receipts on 5ร5 continuous stationery using an Epson LQ-310 impact printer. The normal browser print path rasterises the page to a bitmap, which prints mushy and unreadable on an impact head. This page explains the two print options added to fix that and how to set up the client machine.
On the deposit / payment print-preview screen (and their reprint screens):
| Button | What it does | Use when |
|---|---|---|
| The existing paper format (POS / 5ร5 / A4 as configured). | Laser / inkjet / POS printers. | |
| Print (Dot-Matrix) | A clean monospace receipt, printed through the normal browser dialog. | LQ-310 with the ESC/P driver set to a native font (see below). Try this first. |
| Print (Raw Text) | Downloads a .prn file of the receipt as raw text. A small agent on the PC sends it straight to the printer, bypassing the driver. |
If Print (Dot-Matrix) is still not crisp enough. Matches how standalone billing apps print. |
- Install the printer with the Epson LQ-310 ESC/P2 driver (Windows "Add Printer" โ Epson โ LQ-310). Do not use a generic / text-only driver here.
-
Printer Properties โ Printing Preferences โ Advanced:
- Print Quality = Draft or LQ (Near Letter Quality) โ not "Photo" / "Best".
- "Print Text as Graphics" = OFF (label varies: "Send TrueType as Bitmap = No", "Print Mode = Native", "Graphics = Draft").
- Paper size = custom 5 in ร 5 in (or your form's real length).
- Paper source = Tractor / Continuous.
- In the Chrome print dialog for this printer:
- Margins = None
- Scale = 100 / Default
- Headers and footers = OFF
- Background graphics = OFF
- Set it as the default destination and click Save.
- If the receipt prints over your pre-printed letterhead, set the ConfigOption
Inward Dot Matrix Receipt Preprinted Stationery= true (per department) and tuneInward Dot Matrix Receipt Top Margin Lines(default 8) until the body clears the pre-printed logo.
The .prn file must reach the LQ-310 as raw bytes. Pick one option.
- Share the printer (share name e.g.
LQ310) or note its LPT port. - After clicking Print (Raw Text), from a Command Prompt:
(or
copy /b "%USERPROFILE%\Downloads\inward-deposit-123.prn" \\localhost\LQ310... \\.\LPT1). It prints immediately, crisp, with no driver rasterisation. Use this to confirm quality before setting up the agent.
The agent sends raw bytes to the printer's local UNC share, so the printer must be shared on the cashier PC itself. No admin rights are needed anywhere in this procedure.
- Share the printer locally: Printer Properties โ Sharing tab โ tick "Share this printer". Any share name will do โ the agent looks it up from the printer name.
- Copy the contents of
tools/client-print-agent/(from the repo) toC:\hmis-print\. - Copy
print-agent-config.example.jsontoprint-agent-config.jsonin that same folder and set:-
WatchFolderโ where Chrome saves the.prnfiles, e.g.C:\hmis-print -
PrinterPathโ the exact installed printer name from Settings > Printers & scanners (e.g.DEPOSIT), the one you just shared -
FileGlobโinward-*.prn -
PollSecondsโ how often to check the folder, e.g.2
-
- In Chrome โ Settings โ Downloads: set Location to
C:\hmis-print\and turn OFF "Ask where to save each file". - Put a shortcut to
start-agent-hidden.vbsin the current user's Startup folder,%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup, so the agent starts hidden at every logon. (This replaces the old Task Scheduler route, which many cashier PCs won't allow for a standard account.) - Log off / on, or double-click the shortcut to start it immediately. Confirm
agent.logโ written next to the script, not in the watch folder โ shows awatching ... -> <printer> (\\...\...)line.
Now Print (Raw Text) โ file lands in C:\hmis-print\ โ agent prints it โ
file is deleted. Fully hands-off.
- Each file is renamed to
.processingbefore printing, so the same receipt can never be picked up and printed twice. - If the printer is unavailable, the job is retried a few times and then moved
to a
failed\subfolder โ not retried forever on every poll. - If the agent is killed mid-job (reboot, logoff, crash), the leftover
.processingfile is moved tofailed\at the next startup. It is deliberately not reprinted, because the interrupted run may already have sent it to the spooler. Check whether it printed before re-dropping it into the watch folder. - Starting the agent twice over the same folder is blocked by a named mutex, so a manual start on top of the Startup one cannot double-print.
| Symptom | Fix |
|---|---|
Control codes (โ@, โx) printed literally on the page |
The transport is stripping / re-encoding 8-bit bytes. Set ConfigOption Inward Raw Text Receipt Emit ESC/P Codes = false for pure ASCII. |
| Nothing prints, no error | Printer share name / LPT path wrong. Test with the Option 1 copy /b command first. |
agent.log shows FATAL: no printer named '<name>' is installed
|
PrinterPath in print-agent-config.json must match the printer's exact name in Settings > Printers & scanners. |
agent.log shows FATAL: printer '<name>' is not shared
|
The agent sends raw bytes via the printer's local UNC share. Printer Properties โ Sharing โ "Share this printer". |
Agent starts and logs watching ... but nothing prints |
Check the failed\ subfolder of the watch folder โ undeliverable jobs are moved there rather than retried forever. agent.log names each one. |
copy /b to a remote share fails with "Access is denied" |
The account lacks file-share permission on the print server's queue. Share the printer locally on the cashier PC instead and point PrinterPath at that local printer, so the agent uses \\<this-pc>\<sharename> and needs no permission on the remote server. |
| Prints half the receipt then ejects the whole form | Form length in the driver โ your stationery. Set the custom paper size to the real form length; the raw path emits one form-feed at the end. |
| Two copies of the receipt on screen | The dot-matrix preview is meant to be hidden until you print. If it shows, the Inward Payment Bill Dot Matrix Paper config is on โ that is expected (it makes the monospace receipt the default preview). |
| Body still overlaps pre-printed header | Increase Inward Dot Matrix Receipt Top Margin Lines (Dot-Matrix button) or Inward Raw Text Receipt Top Margin Lines (Raw Text button). |
| Key | Type | Default | Scope | Effect |
|---|---|---|---|---|
Inward Payment Bill Dot Matrix Paper |
bool | false | global/dept | Makes the monospace receipt the default on-screen preview + plain Print target. |
Inward Dot Matrix Receipt Preprinted Stationery |
bool | false | dept-first | Suppress the app's text header; drop the body below pre-printed letterhead. |
Inward Dot Matrix Receipt Top Margin Lines |
int | 8 | dept-first | Blank leading lines when the above is true. |
Print Barcode on Inward Dot Matrix Receipt |
bool | false | global/dept | Include the (bitmap) barcode. Off for LQ. |
Inward Raw Text Receipt Preprinted Stationery |
bool | false | dept-first | Same as its Dot-Matrix twin, for the Raw Text file. |
Inward Raw Text Receipt Top Margin Lines |
int | 8 | dept-first | Blank leading lines in the Raw Text file. |
Inward Raw Text Receipt Emit ESC/P Codes |
bool | true | global/dept | Wrap the file in ESC/P init + form-feed. Turn off if the transport mangles control bytes. |