transporindo-pusat's avatar

How to Print a Web Page (HTML) to a Dot-Matrix Printer (e.g., Epson LQ-2180) in Text Mode?

The Question Scenario:

I have a web-based application (like an inventory system or a point-of-sale) that generates invoices and reports as HTML pages. I need to print these onto multi-part carbon copy paper using our reliable old Epson LQ-2180 dot-matrix printer.

The Problem:

Printing directly from the browser (e.g., Chrome's Ctrl+P) is problematic:

It's slow: The browser tries to render the full graphical page, which is very slow on a dot-matrix printer. It looks wrong: Fonts, layouts, and margins don't translate well. The output is often garbled or poorly aligned. It's wasteful: It uses a lot of ribbon trying to print graphics and rich formatting. I don't want the graphics, colors, or fancy CSS layouts. I just want the core text content (headings, paragraphs, and especially data from tables) printed in the printer's native, fast "Text Mode" or "Draft Mode".

If I save the HTML file and try to send it to the printer from the command line, it just prints all the raw HTML tags like , , , etc.

The Goal:

How can I take a URL, extract its meaningful text content, and send it directly to an LQ-2180 printer in raw text mode, bypassing the graphical print driver?

0 likes
3 replies
jlrdw's avatar

If not too many rows can you export to excel format and print from a spreadsheet?

I would normally dump to local, and print from MS Access via an ODBC. I wrote some internal reports in Access and VBA.

But I suggest a newer printer.

Glukinho's avatar

You should play with CSS @media print { }, it can adjust very flexibly what should and shouldn't be printed, and what styles are applied. Your printed page can look completely different compared to browser.

For example, you can remove all images and unnecessary elements, apply basic font and make text bigger, so it will be printed properly on your old-fashioned printer.

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_media_queries/Printing

Please or to participate in this conversation.