Java printing quality in Linux on dot-matrix printer

前端 未结 3 2194
情歌与酒
情歌与酒 2021-02-10 14:06

I need to print the report from a Java desktop application to a dot-matrix printer (Epson LX-300 II). Report consists of text ang some graphics. Printer is connected via USB and

3条回答
  •  醉酒成梦
    2021-02-10 14:39

    [ tl;dr: It's practically impossible. Use another printer or switch to text mode. ]

    Dot-matrix printers, especially the 9-pin variety (such as Epson's LX series), are more or less optimised for text printing. While it is possible to print graphics, their resolution is really low, much lower than today's standard printers. In times past, you had to optimise your output such as to get maximum fidelity from your printout; nobody in their right mind would have tried to print text in graphics mode on those printers, which practically guarantees an unreadable output. The printer's built-in fonts are optimised for readability, but if the rasterisation is done by the printer driver without regard to the particularities of the printer, the result has to be less optimal.

    The resolution of 9-pin printers such as Epson's LX series is way too low for this. Unless you print in text mode (which, if you didn't build that reporting application yourself, is pretty much impossible), you won't get a better result. A 24-pin printer would have enough 'reserve' to still get you decent enough printout, but a 9-pin printer is already operating on its limits.

    Whatever trickery you do with font hinting or whatever, unless you use really big fonts (where the font is big enough to offset the low resolution of the printer), there's nothing you can do, short of using another printer. The problem is the rasterisation, which cannot fit the physical limitations of the printer.

    ( The 'correct' way to do reports on a dot-matrix printer would be to print whatever possible as 'pure' text, exploiting the various ESC/P formatting commands such as boldface, underlining and so on. If you needed graphics, you would enter graphics mode for that particular graphic, then continue in text mode. The printer's built-in fonts are optimised to be as readable as possible, given the limitations of the way the printer operates, though it is possible to define your own. )

    This is from experience: I still own a 9-pin and several 24-pin printers (all Epsons) and mostly drive them in text mode. I can (and do) use the 24-pin printer as a generic Windows (or whatever) printer, but with the 9-pin printer this is practically unfeasible. But with some thought, I can get quite nice results out of them which would require a lot more work on more 'modern' printers.

提交回复
热议问题