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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top