13

I have many GWBasic programs peppered with Epson-specific escape sequences (ESC/P). Unfortunately I no longer have any printers that support these escape sequences.

Is there any way I can convert these programs to a more usable format whilst preserving the formatting described by the escape sequences? [![esc\p codes

2
  • 2
    Welcome to Retrocomputing Stack Exchange. You've come to the right place, but at present your question is worded a bit like a support request. I'll have a go at editing it; please read the tour whilst you're waiting. If my edit conflicts with your question feel free to roll it back by clicking on the "edited: time times ago" blue text that appears above.
    – wizzwizz4
    May 9, 2017 at 18:15
  • Anyone who knows PostScript might want to give a converter a try - here's a ESC/P-83 specification.
    – wizzwizz4
    May 9, 2017 at 18:31

7 Answers 7

18

If you can get your output to a file using redirection, then you can use the Linux open-source project called dotprint to convert the file into a PDF document for printing on a modern printer, viewing on-screen, or transmitting.

From the dotprint README:

dotprint is a tool that can be used to convert text files that include escape sequences for dot matrix printers into PDF files. Nowadays you are not likely to come across such files often but they were common in the "bad old days" of DOS. Programs would often assume an "epson-compatible" dot matrix printer and would embed the escape sequences (for e.g. condensed or expanded font) into the output.

The source code and instructions are on GitHub.

7
  • 1
    There's source code here - this code needs compiling in order to run. It's possible to compile for Windows, but considering that it requires other packages as well, compiling might be a bit hard for the average Windows user (which I assume the OP is using; Mac might be being used instead).
    – wizzwizz4
    May 9, 2017 at 19:41
  • 3
    Probably can work in Cygwin.
    – Brian H
    May 9, 2017 at 22:04
  • 1
    doesn't build under gcc 6.3 and didn't understand any of the test Epson FX codes I sent it from Word 5.5.
    – scruss
    May 10, 2017 at 14:25
  • @scruss Nice to see the fix is also simple. I just compiled myself on gcc 6.3. What kind of codes are you sending it? Simple stuff like bold and italic? You know it has to be in UTF8 first, right?
    – Brian H
    May 10, 2017 at 21:57
  • 1
    Yup; no codes above ASCII 127. No joy.
    – scruss
    May 11, 2017 at 1:32
6

I use QPCPrint (as mentioned above) on my PC, but have also released my own ESC/P2 to PDF convertor - https://github.com/RWAP/PrinterToPDF, written in C, which is designed to run on Linux

5

ESCParser (github: https://github.com/nzeemin/ukncbtl-utils/wiki/ESCParser, win32 binary: https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ukncbtl/ESCParser.zip) converts a variant of ESC/P to PostScript and SVG.

1
1

You cannot expect accurate results because the basic units of these ESC/P commands depend on the printer. For example, 9-pin printers often used a basic line spacing of 1/216 inch (1/3 * 1/72), while 24-pin printers used 1/360 inch (1/5 * 1/72) instead. For the horizontal direction, the spacing may be anything from 1/60 inch to 1/360 inch, and it is printer-dependent which command selects which density. 24-pin printers often support triple and/or quadruple density modes which are completely non-standard.

So, show us the ESC/P codes in your programs and the printer they have been written for and we may be able to help you.

10
  • will copy escape code sequences and show soon. In the meantime the May 9, 2017 at 23:01
  • Original printer 24-pin Panasonic, and more recently Epson color 600Q May 9, 2017 at 23:02
  • have jpeg of escape codes used - how do I get it to you May 9, 2017 at 23:43
  • Just add it to your question.
    – Janka
    May 9, 2017 at 23:57
  • jpeg added to original question ( I think) May 10, 2017 at 0:31
1

There is a nice (commercial, but relatively cheap) program called QPCPrint that does on-the-fly translation from Epson ESC/P escape codes received on a virtual LPT port to whatever modern printer you might have connected to your PC. This program allows you to leave the programs that were built to print to Epson printers completely unchanged and print to a modern printer.

3
  • My browser tells me the link is broken.
    – JeremyP
    May 10, 2017 at 8:23
  • @JeremyP Funny. Works here.
    – tofro
    May 10, 2017 at 8:29
  • sounds great - will investigate -- mny thks May 10, 2017 at 17:31
1

Some other Windows versions that have not been suggested. SwIt Printfil Printfil site I couldn't get Printfil to work for my Epson esc files, the graphics didn't render correctly no matter what I did. Too bad because it will capture printer ports and create an archive of PDFs.

I also worked with DosPrinter DosPrinter it came as part of vDOSBox and was effective at converting my files to a Windows printer output. Unfortunately, the built in PDF converter didn't render the graphics as well as using a Windows printer or XPS writter.

The QPCPrint demo worked quite well, wish it had a built in PDF converter.

0

Converting the programs depends on

  1. what platform you want to run the programs on;

  2. how much of the Epson command set you depended on.

If you were doing fancy formatting relying on fixed width fonts and tabbing, that kind of formatting has mostly gone away. But if you're just doing bold and maybe centring, then outputting to HTML could be an option. The Epson's bold on/off could easily be replicated with HTML's <strong> … </strong> markup, for example.

If you're looking for a converter, epsonps is a basic Epson to PostScript filter. While it's limited it does have the advantage of being developed while dot-matrix printers were a thing, so it makes an attempt to handle most input gracefully.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .