I am currently attempting a project which involves one of my companies existing thermal printers (Star Micronics SM-T300i) and a raspberry pi board. I am attempting to communicate with it via Bluetooth. I have successfully paired the devices and found a test program and tutorial which shows how to communicate to the thermal printer and produce a test print.
Tutorial: http://natemcbean.com/2012/11/rpi-thermal-printer/
The code is found here: https://github.com/luopio/py-thermal-printer/blob/master/printer.py
I provided a link because I couldn't get it to fit in the code block correctly.
The only thing I changed was the serial port: SERIALPORT = '/dev/ttyAMA0'
which I changed to SERIALPORT = '/dev/rfcomm0'
to work with the bluetooth serial connection and I changed the Baudrate to 115200 because it is the rate we use in other applications with this printer. Originally I left the Baudrate set to the default in the code and it worked the same only it was slower.
The test prints fine in the text based parts but does not print the png file, instead it prints a bunch of unreadable text where the image should be. I originally thought that maybe the image was too large for my printer but the tutorial shows a 2.25 inch width and mine is 3 so I think it should be able to fit properly.
I did also import ImageTk after I installed it with sudo apt-get install python-imaging-tk
.
I want to know if this is possible to print the image and what steps I might need in order to solve this. I have had no issue printing text or even the barcodes in the example but a .png file or other image has not been successful. I am new to python as we generally use C++ but I have not been able to find any useful source for how to print this. Perhaps I am searching for the wrong terms.