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.
| Video | What it shows |
|---|---|
| Raw Text printing for inpatient payment and deposit receipts (about 3 min) | Cashiers and administrators: turning on Raw Text in Settings, setting the line width, printing a payment receipt as a .prn file, the one-time printer setup panel, and reprinting the original or a duplicate |
The deposit, payment and reprint screens show the print buttons for the paper type chosen in Settings (the cog on the receipt preview; needs the Change Receipt Printing Paper Types privilege):
| Paper type | Set for | Buttons shown | Use with |
|---|---|---|---|
| POS / 5ร5 / 5ร5 Custom 3 / A4 | the logged-in department | Laser / inkjet / POS printers. | |
| Dot-Matrix Paper (LQ-310) | the logged-in department | Print and Print (Dot-Matrix): a clean monospace receipt printed through the browser dialog | LQ-310 with the ESC/P driver set to a native font (Track A below). Try this first. |
| Raw Text (Dot-Matrix) | the logged-in department |
Print (Raw Text) only. The receipt downloads as a .prn file that the print agent sends straight to the printer. |
When Print (Dot-Matrix) is still not crisp enough (Track B below). |
When a department uses Raw Text, it replaces the other paper types on that department's screens. The preview then shows an approximate picture of the dot-matrix print. The Raw Text (Dot-Matrix) card in Settings also sets that department's top margin, line width, pre-printed stationery and which patient rows to print.
A collapsed Raw text printer setup (one-time per PC) panel under the preview has the Download print agent (.zip) button and the short setup steps. Track B below has the full details.
If the first print fails (printer jam, breakdown, paper out), open the bill again from Money icon โ Payment Management โ Inward Deposit โ Deposit Search (or Payment Search) and click the bill to open its reprint screen. When the department uses the Raw Text paper type, the reprint screen previews both copies and has two Raw Text buttons:
| Button | Prints |
|---|---|
| Print Original (Raw Text) | The receipt exactly as the first print โ no Duplicate marker. Use this when the original never reached the patient. |
| Print Duplicate (Raw Text) | The receipt with **Duplicate** beside the heading. Use this for a second copy. |


Original reprints download as inward-reprint-original-<bill no>.prn and
duplicates as inward-reprint-<bill no>.prn. Both match the agent's default
inward-*.prn file pattern, so no agent change is needed.
The Back to Payments button on both reprint screens returns to the Payment Management page.
- 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.
- On a deposit or payment receipt screen, open Raw text printer setup (one-time per PC)
under the preview, click Download print agent (.zip) and unzip it to
C:\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). |
| Ends of lines missing at the right edge (Raw Text button) | Lower Inward Raw Text Receipt Line Width (default 40) for that department โ e.g. 36 โ until every line fits on the paper. |
| 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). |
Where to change them: dept-first options are set per department at Administration โ Manage Institutions โ Department Options. Select the department the cashier logs in to (e.g. Inward), select List Department Options, type Raw Text in the search box, then Edit. The rows appear after the first Print (Raw Text) from that department. global options are at Administration โ Manage Institutions โ Application Options. The Settings button on the deposit/payment page only switches the paper format.
| 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 Line Width |
int | 40 | dept-first | Characters per line in the Raw Text file (24โ136). Lower it if the ends of lines are cut off at the right edge of the paper. |
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. |