Git Product home page Git Product logo

print2ble's Introduction

Print2BLE

Copyright (c) 2021 BitBank Software, Inc.
Written by Larry Bank
[email protected]

Print2BLE
What is it?

This project is a MacOS GUI application to print image files on inexpensive Bluetooth Low Energy thermal printers. It allows you to drag supported image files (e.g. JPEG, PNG, BMP, TIFF, GIF) onto a window, convert them to 1-bpp dithered and then send them to the printer.

Why did you write it?

I've been experimenting with BLE thermal printers on microcontrollers and wanted to explore BLE client (central) programming on MacOS to talk to these same devices. This then morphed into the idea of making a simple drag+drop app to allow printing of images. By sharing this code, hopefully other people will find it a useful resource for info about BLE programming, manipulating images, and communicating with 'unsupported/undocumented' thermal printers.

How to use it?

Upon running the app, you will be presented with a window containing 2 push buttons. The connect button will scan for supported printers and connect to the first one it finds. The status text will update to show that it connected to the named device. Next, drag an image onto the window from the Finder. A preview will display how it will look on paper. If you're satisfied with the results, press the print button.

What printers does it support?

It currently supports the GOOJPRT PT210/MTP-2, MTP-3, 'cat/pig/panda' and PeriPage 304pi A6. As I get info for other printers, I'll add support for them too.

If you find this code useful, please consider becoming a sponsor or sending a donation.

paypal

print2ble's People

Contributors

bitbank2 avatar andypiper avatar leolobato avatar

Stargazers

Nikit phadke avatar Hernan Valenzuela avatar Chris Murphy avatar Vitaly avatar cheese avatar Ethan Priest avatar Chris Fasel avatar Joe Rork avatar  avatar George Moon avatar  avatar Jarek Pendowski avatar Nico Geiger avatar  avatar  avatar Taylor Woodcock avatar Konstantinos Douloudis avatar Shawn A avatar Călin Ilie avatar  avatar Giacinto Carlucci avatar Jean-Sylvain Granier avatar Jessica Fae DiMauro avatar sungyong avatar Finley Warman avatar Gabriel Lee avatar Tim Turner avatar srun Domn. avatar Mladen Srdic avatar Omar Rizwan avatar Sebastian Carrera avatar Luís Leão avatar Bassem avatar Ivo Damjanović avatar rené avatar Ade Thompson avatar stieglitzz avatar Christian W. avatar keimoger avatar Earl Celis avatar Shiqian Dong avatar Pauli Jokela avatar cc5770 avatar Thomas Hannen avatar Derek avatar  avatar  avatar Patrick Seal avatar Emma Humphries avatar Matthias Neeracher avatar Andrew Pile avatar  avatar tomf avatar Jack Howard avatar  avatar Philip Brechler avatar Jauder Ho avatar Rembrand avatar alba avatar Sylvain LAFRASSE avatar Joshua Moreno avatar Szymon Łopaciuk avatar Reece Butler avatar John Daniels avatar Jonathan Dahan avatar Tony Vieira avatar  avatar tobozo avatar Joel Haasnoot avatar

Watchers

Jonathan Dahan avatar Ade Thompson avatar Joel Haasnoot avatar James Cloos avatar Tony Vieira avatar  avatar  avatar  avatar

print2ble's Issues

Image prints are truncated

On a GB03 printer (PR #7) everything appears to be OK, but the prints are too "short" - only about ~20% of the image (vertically) is printed. Unclear whether this is something to do with the height calculation - the preview image shows up correctly in the window after being dropped in.

Can't connect

Steps to replicate:

Power up the printer.
The printer is flashing a blue LED.
When I run the app (from the binary in the zip file), and click on Connect, nothing happens:

ScreenFlow

I am using:
Cat thermal printer "MINI Printer", which registers as bluetooth name "MX06" using the official Fun Print iOS app
MacBook Pro M1 running MacOS 12.4

Any advice for fault finding appreciated

Consider moving zip file to Releases?

Thanks for adding the feed button, going to try it out now.

Rather than commit the binary/zip to the repo, it might be a good idea to have it on the Releases page instead.

Support for older MacOS versions

Would it be possible to make this app (or a version of it) compatible with 10.14 (Mojave)?
I tried using xcode to export it to other versions but it just gives me errors like these:

/Applications/peripage/Print2BLE/Print2BLE/ViewController.m:46:5: Expression result unused

/Applications/peripage/Print2BLE/Print2BLE/MyBLE.m:112:30: Sending 'MyBLE *const __strong' to parameter of incompatible type 'id<CBPeripheralDelegate> _Nullable'

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h:62:63: Passing argument to parameter 'delegate' here

Is it possible to use the protocol in iOS project?

From other repositories for Peripage bluetooth projects, they said the Peripage printer use RFCOMM SPP protocol to send and receive data. But this project uses BLE which is totally different.

  1. If Peripage uses BLE for communication between Peripheral and Central, I think it can be used in iOS project?
  2. Will it be possible to support Paperang Printer?

No Content in Window

Hi there,

i just tried your Application on my Macbook Pro (M2) but sadly the Window is empty.

I can't even get the MTP-2 Printer to show up in System config to be honest.

Spool more paper after printing

Just tried this and it works! Thanks for making this.

One request would be to have the printer spool more paper after printing so that the bottom of the image is not cut off and there is some whitespace between print jobs. Thanks.

Fails to build and to start on MacOS 13 Ventura

Debug fails with

2022-11-17 22:08:09.379362+0100 Print2BLE[76575:1578471] *** Assertion failure in _NSTrackingAreaViewHelper *trackingAreaHelper(NSView *)(), winTrackingAreas.m:168
2022-11-17 22:08:09.379625+0100 Print2BLE[76575:1578471] Failed to set (contentViewController) user defined inspected property on (NSWindow): _trackingAreaHelper not allocated yet!

I am discovering XCode and ObjectiveC and can only report.

Add support for Royal PT-300

I have a Royal PT-300 receipt printer, which supports both Classic Bluetooth and BLE. In order to make BLE work, I had to connect to the printer in setup mode and set the printer to "label mode". Once I did that, the printer started broadcasting as Printer_{first 4 hex of MAC address} i.e. Printer_AAAA. I added Printer_ to the list of valid printer names, and I was able to print images from my Mac using your library without any issues, so adding Printer_ to this list should be an easy way to add support for the Royal PT-300.

One thing I noticed is with larger images, I saw some buffer overrun issues. One image printed with part of it sheared off, and another printed garbled text. This usually happens when the source device's buffer is overwhelmed or when some data is written to the stream but is lost, which results in the printer's ESC/POS commands getting offset. I wonder if there's some issue with the BLE implementation where it's losing bits somewhere, or if this is specific to my printer (and likely a buffering issue)? I don't see the same issue using my library ESCPOS_NET and printing over WiFi to the printer, but the WiFi chip and the BLE chip may have different buffer sizes or something.

Feed Paper

Hi!
I'm trying to use the feed paper method but it does not seem to be working. Im currently testing on peripage a6.
Is anyone else also having the same issue?

Support for "SB200" printer

Could you add support for the "Jooheli" Brand printer?
It identifies as "SB200" over Bluetooth and under Systeminformation it shows the following Informations:

SB200:
Adresse: 00:1D:DF:70:4C:CB
Hersteller-ID: 0x0057
Produkt-ID: 0x0005
Firmwareversion: 0.0.7
Minor Type: GenericAudioVideo
RSSI: -80
Dienste: 0x800018 < AVRCP A2DP ACL >

thanks in advance :)

feature request: transparency -> white

For images with transparency, the dithering algorithm currently treats this as black, which is pretty ugly - it would be good to assume that this should be white (or provide an option for this)

Support for the Phomemo T02

Hey there!

Me and my class mates are working on this project where want to print our own custom bills with the Phomemo T02 heat printer.
It would mean the world to use if you could support this printer in your program so we could automate our process a little!

Yours trully,

  • xrayessay

MTP-II versus MTP-2

My device (GOOJPRT) announces itself as "MTP-II" instead of "MTP-2" and is thus not picked up by the macOS application.

Is there anything I missed to select this device?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.