HTML for "beautiful" text conversion for printing on a text printer only (matrix)

I have a website that generates some simple tabular data in the form of html tables, many of my users print the web page on a laser / inkjet printer; however, some of them prefer to print on Dot Matrix print printers (text only) and this is the problem.

When printing from a web browser to a dot matrix printer, the printer really perceives the data as “graphics” / images and continues to print them dot by dot.

ie If printing the character "C", the printer cuts it horizontally and prints for 3-4 passes.

The same printer prints text from an ASCII file (say, from notepad) in the form of full characters in one pass, thereby 5 times faster and much quieter than when printing a web page.

(I even tried the "universal text driver", but Mozilla Firefox knows an error that doesn't print anything on this particular driver with 2.0+)

So, is there some kind of clean way to format the already generated HTML (for example, the method takes the whole html table as a string) and generates the corresponding text file with correctly aligned columns?

I tried to remove the html descriptors, but the main problem is the good “wrapping” of the cell data and maintaining the integrity of the data of other cells (from the same line).

for example: ('|' and '_' are not required)

Col1    |  Col2      |  Colum_Name3  |  Col4   |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
1       |  this cell | this column   | smaller |
        | is in three| spans 2 rows  |         |
        | rows       |               |         |
- - - - - - - - - - - - - - - - - - - - - - - - 
2       | smaller now| this also     | but this|
        |            |               | cell  |
        |            |               | data is |
        |            |               | now     |
        |            |               | bigger  |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Could you suggest a preferred approach?

xslt - ( pdf), Apache FOP , , . - .

+3
1

, : , Lynx: http://lynx.isc.org/ Elinks: http://elinks.or.cz/

EDIT: , Lynx , Elinks .

+1

Source: https://habr.com/ru/post/1745463/


All Articles