wordgrinder icon indicating copy to clipboard operation
wordgrinder copied to clipboard

Printing Text

Open iam-TJ opened this issue 2 years ago • 1 comments

I've read issue #4 and issue #54 and understand the desire not to have external dependencies.

I've recently discovered wordgrinder in the context of looking for a basic tool that could accommodate handling basic printer description language (PDL) Escape codes and utilise PCL5 to harness internal printer features such as ROM-based fonts, page layout, and more.

I'm currently writing a PCL5 interpreter that can take text input and insert PCL5 escape codes into the text stream which could then be sent, either directly or via a file, to a PCL5 compatible printer, as programs like WordPerfect, WordStar, Informix Smartware 2, etc., did originally.

I wondered if you'd accept a PR for an Export filter that supports doing this? I ask since I'm already modifying wordgrinder to make testing the PCL5 interpreter easier.

The aim is to avoid Postscript/PDF whilst being able to get great quality print output natively from the printer.

As an example of embedding raw PCL5 Escape codes here's a simply shell command that sends PCL5 to print a large, vertically rotated, message using a printer ROM font ("Garamond SWC Italic Bold") at 48pt 25.4mm from left edge, 50.8mm from top edge, on A4 paper to a USB-attached laser printer:

printf "\x1b%-12345X\x1bE\x1b&l1440U\x1b&l2880Z\x1b&l26A\x1b&a0P\x1b(10U\x1b(s1p48.00v1s3b4197T Hello from Tj \x1bE\x1b%-12345X"  > /dev/usb/lp0

iam-TJ avatar Apr 28 '23 18:04 iam-TJ

That does sound like it's out-of-scope for WordGrinder --- plus, wouldn't it require detailed knowledge of the metrics of the printer fonts in order to get the layout correct?

I generally reckon that existing tools like troff, Latex or pandoc can do a better job of this than WordGrinder can and am happy to delegate to those.

davidgiven avatar May 05 '23 13:05 davidgiven