How can I cleanly print a web page to a dot-matrix printer?

Madhur Rampal picture Madhur Rampal · Dec 10, 2012 · Viewed 8k times · Source

I have an Epson LX 300 dot matrix printer.

I'm using PHP to create an HTML receipt, and am using Javascript's window.print() to ask the browser to print the web page. Unfortunately the printer can not handle the formatted text. Font sizes are incorrect, areas overlap, etc.

Printing normal text generated in Notepad and Wordpad does not cause any problems.

What can I do to fix this problem?

Answer

You need to create different css rules for printing, and set them on your page this way

<LINK rel="stylesheet" type"text/css" href="print.css" media="print">

Inside this css you can set display:none to images, set universal font-size for all elements without changing anything on your site.