HP Forums
Print42 - thermal printer software for Free42 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: Print42 - thermal printer software for Free42 (/thread-11396.html)

Pages: 1 2


Print42 - thermal printer software for Free42 - tcab - 09-14-2018 01:29 PM

I am pleased to announce the release of Print42, a windows/mac application that lets you echo the Free42 virtual tape to a real thermal printer.





The video is 13 minutes long and covers the basic use cases, history of the project etc.

As well as physically printing from Free42, the Print42 software can also be used to print HP Prime screenshots (from either the emulator or real HP Prime hardware via the HP connectivity kit).

Outside the world of calculators, Print42 can be used to 'tail' log files (programmers take note) and to print graphic snippets from the web. Useful if you want to rapidly print information to stuff into your pocket or to study and annotate printouts of complex information, at your desk.

If you are looking for a useful, fun new gadget, you might want to consider buying an Epson thermal printer and trying Print42. However you can also use Print42 with your regular desktop printer, for free.

The website for downloads and further information is http://www.print42.atug.com


RE: Print42 - thermal printer software for Free42 - ijabbott - 09-15-2018 11:52 AM

It would be handy if it could capture output from a red-eye USB serial converter (such as the home-brewed, Arduino-based one by Martin Hepperle), or failing that, capture the output from Christoph Gießelink's HP82240B Printer Simulator (which can capture output from the red-eye USB serial converters and the output from Emu28, Emu42 and Emu48, but lacks support for ESC/POS thermal printers). This would allow real HP calculators to print to ESC/POS thermal printers via your Print42 software, in theory.


RE: Print42 - thermal printer software for Free42 - tcab - 09-16-2018 02:28 AM

Actually I've had quite a few people suggest integrating Print42 with the HP red eye protocol, allowing a variety of real HP calculators (and DM42) to print to a modern thermal printer.

As long as the red eye receiving solution can create a unicode text file or a series of images, Print42 would be able to pick those up and print. Print42 would not even need to be changed in any way. I can think of a couple of specific design possibilities:
  • Create a box of hardware containing: infra red receiver, Arduino etc, which generates files on a PC/Mac. Print42 running on the PC/Mac would detect changes to those files and print.
  • Create a box of hardware containing: infra red receiver, Arduino etc, and Raspberry Pi running Print42 (under linux). Simply plug the thermal printer USB into the box and point your calculator!
The latter solution would certainly be an exciting box! I'm not sure how many people would be interested in this sort of project. I can offer a free license of Free42 Print42 for anyone demonstrating that they are building infra red integrations for Print42, as long as they share their solution. I could possibly provide deeper integration of Print42 with any such solution, to avoid intermediary files. Long term, I would even consider more relaxed licensing for all such linux/raspberry pi deployments.

-Andy


RE: Print42 - thermal printer software for Free42 - grsbanks - 09-16-2018 06:26 AM

(09-16-2018 02:28 AM)tcab Wrote:  I can offer a free license of Free42 […]

Surely only Thomas Okken can decide on the licensing of Free42?


RE: Print42 - thermal printer software for Free42 - Ken S - 09-16-2018 07:04 AM

I noticed that too but am pretty sure he meant to say Print42.


RE: Print42 - thermal printer software for Free42 - tcab - 09-16-2018 07:55 AM

(09-16-2018 06:26 AM)grsbanks Wrote:  
(09-16-2018 02:28 AM)tcab Wrote:  I can offer a free license of Free42 […]

Surely only Thomas Okken can decide on the licensing of Free42?

Oops Blush, corrected. Yes I meant Print42.


RE: Print42 - thermal printer software for Free42 - tcab - 09-21-2018 03:06 AM

A new version of Print42 has been released today version 1.0.2 with ability to filter the virtual tape output, so that only lines that match the filter get printed or displayed.

[Image: print42%20filter%20free42%20feature.png?raw=1]

For example by setting the filter to "LBL", then printing the very long program "PLOT" via Free42, you get an arguably useful summary of all labels in the program.

Code:

 01▸LBL "PLOT"
 08▸LBL A
 41▸LBL 00
 49▸LBL 01
 65▸LBL 03
 69▸LBL 04
 83▸LBL 05
 90▸LBL 06
 105▸LBL 07

You don't need to have thermal printing turned on either, the filtering will happen on the visual virtual tape too.

When Print42 is used outside the calculator context, with any general log file, I can imagine filtering on lines with e.g. the word 'error' in them, so that only errors lines are printed to the thermal printer, which is left running overnight. In the morning a programmer, sys admin or programming team can rapidly see and tear off the list of errors that occurred. Hopefully not too many - or else the printer tape will be like a very long stockmarket ticker tape on the day of a stockmarket crash!


RE: Print42 - thermal printer software for Free42 - jpcuzzourt - 10-31-2019 08:19 AM

(09-16-2018 02:28 AM)tcab Wrote:  Actually I've had quite a few people suggest integrating Print42 with the HP red eye protocol, allowing a variety of real HP calculators (and DM42) to print to a modern thermal printer.

As long as the red eye receiving solution can create a unicode text file or a series of images, Print42 would be able to pick those up and print. Print42 would not even need to be changed in any way. I can think of a couple of specific design possibilities:
  • Create a box of hardware containing: infra red receiver, Arduino etc, which generates files on a PC/Mac. Print42 running on the PC/Mac would detect changes to those files and print.
  • Create a box of hardware containing: infra red receiver, Arduino etc, and Raspberry Pi running Print42 (under linux). Simply plug the thermal printer USB into the box and point your calculator!
The latter solution would certainly be an exciting box! I'm not sure how many people would be interested in this sort of project. I can offer a free license of Free42 Print42 for anyone demonstrating that they are building infra red integrations for Print42, as long as they share their solution. I could possibly provide deeper integration of Print42 with any such solution, to avoid intermediary files. Long term, I would even consider more relaxed licensing for all such linux/raspberry pi deployments.

-Andy

Hi Andy,
As I discussed with you by PM earlier, I'm considering building a Redeye IR enabled portable thermal printer, and have finally gotten a key piece of hardware, the printer itself. It is a $16 delivered from China unit with USB and TTL serial interfaces. (Goojrt model QR204) I got it tonight, and was able to find a nice driver which compiles easily under linux and works well. I've only tested it on my laptop so far, but I expect it to work well with a raspberry pi 0. If you make a raspi version of Print42* available, I'd be happy to test it in my spare time. As time allows, I also plan to work on a Redeye interface for the Raspi, i.e. skipping the arduino-in-the-middle.
Anyway, I just wanted to share with you that I had a printer and suitable raspi driver now.

*Edit - I earlier typed "Free42" - of course I meant "Print42"
(also later corrected printer model number from M204 to QR204)


RE: Print42 - thermal printer software for Free42 - tcab - 11-05-2019 03:15 AM

Hi - great to hear about your thermal printer purchase!

Before I go to the effort of making a linux version of Print42, we need to verify if your bargain printer responds properly to ESCPOS commands and is compatible with the python escpos library that Print42 uses, https://python-escpos.readthedocs.io/en/latest/.

Please install the escpos python library with

Code:

pip install python-escpos==3.0a4

You need to know your printer's vendor and product id e.g. the values for my epson are
"vendorid": "B000",
"productid": "0410"

Then use something like this code to see if it communicates with your printer:

Code:

from escpos import *
x = printer.Usb(0x04b8,0x0202)  # replace with your own printer's vendor and product id
# Print text
x.text("Hello World\n")
# Print image
x.image("logo.gif")
# Print QR Code
x.qr("You can readme from your smartphone")
# Print barcode
x.barcode('1324354657687','EAN13',64,2,'','')
# Cut paper
x.cut()

cheers,
Andy


RE: Print42 - thermal printer software for Free42 - tcab - 11-06-2019 12:06 PM

P.S. To determine the printer’s vendor/product id you can run the Linux command lsusb see https://www.tutorialspoint.com/unix_commands/lsusb.htm which is also installable on Mac using brew.

If on windows, USBDeview might work, otherwise there are some options discussed here.


RE: Print42 - thermal printer software for Free42 - jpcuzzourt - 11-07-2019 07:45 AM

(11-05-2019 03:15 AM)tcab Wrote:  Hi - great to hear about your thermal printer purchase!

Before I go to the effort of making a linux version of Print42, we need to verify if your bargain printer responds properly to ESCPOS commands and is compatible with the python escpos library that Print42 uses, https://python-escpos.readthedocs.io/en/latest/.

...

cheers,
Andy


Hi Andy.
Thanks. I installed python-escpos on my Linux laptop. (MX19)
After a little bit of RTFM, i found the magic to properly instantiate this printer, and the short version: It works fine.

Here is the code snippet I tested:
Code:

from escpos.printer import Usb
x = Usb(0x0fe6,0x811e,0,0x98,0x02)  # these values depend on your printer
# Print text
x.text("\n")
x.text("Hello World\n")
# Print image
x.image("debian-logo.png")
# Print QR Code
x.qr("You can readme from your smartphone")
# Print barcode
x.barcode('1324354657687','EAN13',64,2,'','')
x.text("\n\n\n\n\n\n")
# Cut paper
#x.cut()

Note the extra numbers 0x98 and 0x02 in the printer instantiation line. These were necessary to make the printer work. These are the 'interface' and 'endpoint' numbers, found from following this manual entry.

Text, barcodes, QR codes, and graphics all worked fine.
[attachment=7795]

Cheers,
JP

Quick edit: Note also that this printer does not have a cut() feature, so one has to tear the paper off manually.


RE: Print42 - thermal printer software for Free42 - tcab - 11-09-2019 07:13 AM

Fantastic news!

I've started work on porting the Print42 app to Raspberry Pi - hitting some 32bit, driver and permissions issues... as well as the Electron GUI not wanting to run on Raspberry. I think these are all solvable.

If all else fails, I'm thinking that a command line version of Print42 might be enough - just watching a unicode file for new lines of text and printing them to the printer. Includes the rendering of all HP characters if the printer is an Epson. In GIF mode will watch for a sequence of images being generated and print them, in which case HP fonts are a non issue cos its all graphics.


RE: Print42 - thermal printer software for Free42 - tcab - 11-13-2019 04:25 AM

I've managed to port Print42 to the Raspberry Pi, with all features intact. So as well as watching log files or calculator tape files, you can take advantage of the usual Print42 features, like typing and have each line echoed to the printer, and being able to paste text lines and graphics etc. For screenshots I recommend installing a screen capture tool e.g. "sudo apt install gnome-screenshot" and using it to copy captured images to the clipboard before pasting those graphics into Print42.

Here is the download which you simply unzip then double click on the "Print42" file to run. There is a preferences dialog box for setting up the printer config.

I've made Print42 free for Raspberry Pi, so no rego is required.


RE: Print42 - thermal printer software for Free42 - jpcuzzourt - 11-16-2019 03:01 PM

(11-13-2019 04:25 AM)tcab Wrote:  I've managed to port Print42 to the Raspberry Pi, with all features intact.

...

I've made Print42 free for Raspberry Pi, so no rego is required.

That's great!
I'll give it a try soon.
JP


RE: Print42 - thermal printer software for Free42 - tcab - 12-13-2019 07:12 AM

I've just been working on an Ubuntu version of Print42 and noticed an issue where the log output directory may not exist which prevents Print42 from working properly. Its now fixed, but for the current Raspberry Pi version you may need to
Code:
mkdir -p /home/pi/.cache/print42/log
before running Print42 for the first time.


RE: Print42 - thermal printer software for Free42 - tcab - 12-18-2019 06:27 AM

There is now a new version of Print42 at https://print42.atug.com/download.html which offers the free Raspberry Pi version as a nice .deb installer, as well as an Ubuntu .deb version.

Would love to hear people's experiences hooking up cheap thermal printers to the Raspberry Pi - you can configure the printer settings now, in the Print42 preferences dialog box:

[Image: print42_preferences_dialog.png?raw=1]

P.S. There doesn't seem to be a Raspberry Pi build of Free42? The only thing I found was a post from 2012.


RE: Print42 - thermal printer software for Free42 - Thomas Okken - 12-18-2019 11:14 AM

(12-18-2019 06:27 AM)tcab Wrote:  P.S. There doesn't seem to be a Raspberry Pi build of Free42? The only thing I found was a post from 2012.

Have you tried building it from source? The dependencies have changed in 2.5.12; it used to depend on GTK 2 and libXmu, now it depends on GTK 3 and no longer needs libXmu. Installing libgtk-3-dev should take care of it. At least in theory. Smile


RE: Print42 - thermal printer software for Free42 - ijabbott - 12-18-2019 05:25 PM

(12-18-2019 06:27 AM)tcab Wrote:  P.S. There doesn't seem to be a Raspberry Pi build of Free42? The only thing I found was a post from 2012.

There should be a free42-nologo package, but it's built from Free42 1.4.77 sources (c. 2013) with some build patches.

(EDIT: However, note Debian bug #911464.)

It's nice to see that Thomas has opened up the Free42 source control repositories for public access (on GitHub).


RE: Print42 - thermal printer software for Free42 - Thomas Okken - 12-18-2019 06:52 PM

(12-18-2019 05:25 PM)ijabbott Wrote:  There should be a free42-nologo package, but it's built from Free42 1.4.77 sources (c. 2013) with some build patches.

(EDIT: However, note Debian bug #911464.)

1.4.77 was before I switched from BCD20 to Intel floating-point. Several Free42 packages were abandoned when I made that switch, because I initially used pre-built binaries for the Intel library in my source tree, which rendered those sources unusable on non-x86 and non-Linux platforms.

Starting with 1.5.9, the source tree includes patches for the Intel library sources, so everything can be built from source again from that tree. I don't have a Raspberry Pi and I've never tried building anything for it, but the current Free42 sources do build on a decent variety of systems now (including Solaris and FreeBSD), and on ARM platforms, so I would assume that they work on the Pi as well. In case they don't (hint: be sure to run FPTEST in a debug build to run the Intel library test suite), I'd be happy to help troubleshoot.


RE: Print42 - thermal printer software for Free42 - Thomas Okken - 01-09-2020 01:39 AM

Free42 builds out of the box (or rather, GitHub) on Raspbian 10 now. All that was needed was to add a case for armv7l in gtk/build-intel-lib.sh, and to install the libgtk-3-dev package. You'll also need libasound2-dev if you want to use the ALSA beeper.