OPD Bill Raw Text Dot Matrix Printing - hmislk/hmis GitHub Wiki
OPD bills printed in the 5ร5 Custom 3 format can be sent to an impact (dot-matrix) printer such as the Epson LQ-310 as raw text. The printer then prints every character in its own built-in font instead of a bitmap drawn by the browser.
Why: a browser print is rasterised before it reaches the printer, and on an impact head some digits can come out malformed โ for example a 5 that loses its top-left stroke and reads as a 3. A bill that is correct in the system can then look wrong to a patient or to another hospital's finance department. Raw text removes that step.
The raw text print is an exact replica of the 5ร5 Custom 3 OPD bill โ same fields, same order, same pre-printed 5ร5 stationery. The existing Print button is unchanged.
The Print (Raw Text) button (and a โ settings button) appears when the
department uses the 5ร5 Custom 3 OPD bill
(OPD Sale Bill is FiveFiveCustom3 = true):
| Screen | Menu path | Prints |
|---|---|---|
| Batch bill print (after Settle) | OPD โ Billing โ OPD Billing โ Settle | Every department bill of the batch, each on its own form, repeated for the configured number of OPD bill copies. Paper Type must be FiveFiveCustom3. |
| Bill reprint | OPD โ Search โ OPD Bill Search โ Search โ Manage Bill | The bill, marked **Duplicate**, with a Printed By line. |
| Cancelled batch bill print | after cancelling an OPD batch bill | The bills marked **Cancelled**. |

The Individual Bills panel on the batch bill print screen: the existing Print, the new Print (Raw Text), and the โ settings button.
Clicking Print (Raw Text) downloads a file named opd-bill-<bill no>.prn.
The client print agent sends it straight to the printer โ see
Dot-Matrix Printing for Inward Deposit & Payment Receipts
(Track B) for the one-time client PC setup. For OPD, set the agent's
FileGlob to opd-bill-*.prn (or *.prn if the same printer also prints
inward receipts). For a quick test without the agent:
copy /b "%USERPROFILE%\Downloads\opd-bill-OPDDC__26_000001.prn" \localhost\LQ310
The โ button (privilege ChangeReceiptPrintingPaperTypes) opens the print settings. They are saved for the logged department.

Raw Text Print Settings with the defaults.
| Setting | Config key | Default | Meaning |
|---|---|---|---|
| Top margin (lines) | OPD Raw Text Bill Top Margin Lines |
8 | Blank lines before the bill, to clear the pre-printed hospital header. |
| Left margin (columns) | OPD Raw Text Bill Left Margin Columns |
0 | Spaces before every line. |
| Right border (last printed column) | OPD Raw Text Bill Right Border Column |
50 | The last character column that is actually on the paper. Every value (item values, Total, Discount, Net Total, No of Items, payment amounts) ends exactly on this column and nothing is ever printed beyond it. |
| Characters per inch | OPD Raw Text Bill Characters Per Inch |
12 | 10, 12 or 15 CPI. |
| Form length (lines) | OPD Raw Text Bill Form Length Lines |
0 | Sends the form length to the printer (ESC C n). 0 = keep the printer's own setting. |
| Send ESC/P printer codes | OPD Raw Text Bill Emit ESC/P Codes |
true | Initialise the printer, select LQ mode and the pitch. |
The right-most part of a print line falls just outside the physical paper, so anything printed there is lost (this is how the No of Items value used to disappear). After the first test print:
- If the last digits of the values are cut off โ reduce the right border.
- If the values end well before the paper edge โ increase it.
Changing the right border moves every value and separator line together; long item names (e.g. REPORTING โ Dr. (MR) โฆ) wrap onto the next line under the item name instead of pushing the values out of line.
Department name, **Duplicate** / **Cancelled** markers, Name and
Age/Sex, Bill Date and Bill Time, Bill No (and BHT No when there is
an admission), Payment Method, the item table (NO, ITEM NAME, QTY, VALUE โ
item print name when Show the print name of the items on the 5x5 Custum 3 bill.
is on), Total, Discount and Net Total (only when there is a discount),
No of Items, Billed By with the payment rows, and Printed By on
duplicates. Characters the printer cannot show (e.g. non-breaking spaces,
Sinhala/Tamil text) are replaced so the bill never prints stray symbols.
Issue: #24047