Question

I've been hunting this for quite a while and haven't found an appropriate solution yet.

Setup

I have a cloud-based system which allows many things based around ticketing, and produces PDF receipts for these. These PDFs are currently brought up and printed by the users through the browsers print dialog to a variety of different thermal printers (endless rolls, 80mm wide). There are no problems with this. Here's a summary:

  • Cloud based system for ticketing etc
  • PDF ticket generated, 80mm wide, set height per page (docket could span two pages while only using part of the second)
  • System dialog prints to thermal receipt printer set with a 200mm page height
  • I don't have the ability at this point to implement any printer SDK for this type of printing as our app is cloud based

Next step

We have had requests to allow this functionality for iPads and other tablets or mobile devices. Having looked into this, iOS requires AirPrint capable printers now to be able to print to WiFi networked printers, and Android requires Google Cloud Print. I've moved on from my initial annoyance at the fact that this process is made that much harder than using a laptop, and I'm not particularly bothered with the Android options at this point (client is using iOS).

From here, I've installed Collobos Presto on a laptop/PC that basically provides a 3rd party AirPrint server for selected printers. I can now print to the printer from iOS, however when using a Star TSP100-LAN, connected to our LAN and provided wirelessly by a computer on that network. The problem here is that the ticket has around 1 inch margins on the top and left sides of the ticket, where it prints as expected from the computer. With the Star TSP100-LAN, my paper height must be set to 200mm to print correctly. Even though my PDF ticket may be two pages with the second page being almost completely empty, the printer correctly assumes the end of the page. Some of our other clients are using an Advanpos receipt printer which also correctly detects in this whitespace.

Getting frustrated even more by the lack of options with printing from iOS (e.g. fit to page, possible page margins etc) I tried a few different settings in Presto with no change and Presto support advised me to get a Zebra printer. I've obtained a Zebra QL420+ for evaluation, which has WiFi and Bluetooth connectivity as well as USB. This prints from the laptop but the page size is an issue. With the Zebra QL420+, it doesn't detect the end of the page. It can correctly print when fit to page is enabled but is obeying the 200mm page height exactly, where the Star printer detects the end of the document and finishes.

Star TSP100-LAN

  • I can correctly print from computer to the Star TSP100-LAN via LAN
  • I can print from iPad to this printer via WiFi/Presto software installed on computer, but there are 1 inch margins
  • I can't print from Android to this printer

Zebra QL420+

  • I can print from computer to Zebra QL420+ via USB, but it doesn't detect the end of the second page and feeds blank paper
  • I can connect to the Zebra QL420+ via Bluetooth from Android, but can't open the PDF in Chrome browser window to print it (it downloads it instead, possibly a development issue from my end) so can't print to it
  • I can't detect the Zebra QL420+ via Bluetooth at all on iOS

My question

Does anybody have experience with this sort of problem and have any suggestions? At the end of the day, I want to be able to generate PDF receipts through my web app and be able to print them from iPad/other wireless tablet to a central thermal receipt printer. Can currently do this wirelessly from a laptop (via the Star TSP100-LAN wired in), but not through the tablets consistently.

In the Star case, is it something to do with how I've got the printer set up on the laptop -> Presto -> iPad chain? Is it a problem with margins in generating the PDF?

A workaround I have considered is creating all the tickets etc via iPads and then looking them up on a central computer located next to the printer to print them from, but I'm sure that in today's day and age with modern technology like this there must be a way to achieve it without this step.

Help appreciated, I'll probably put a bounty on this in 2 days time.

EDIT

With an adjusted page width, the Zebra printer responds correctly over WiFi. It requires the PDF page length to be the entire length of the document, otherwise it will fill the 2nd page with blank space. Using TCPDF we haven't been able to let the height be automatic, it seems to require a preset number which is why we have had this program in the past. Will look into this separately.

The Star printer's margin got even bigger when I decreased the page width to what it should be.

Was it helpful?

Solution

The margin issues may be caused by a mismatch between the PDF page size vs. the printer paper size and print width. QL420+ can communicate via Bluetooth with Android, but not with iOS (because QL420+ does not have MFi). QL420+ can communicate over WiFi with both iOS and Android. The Zebra iMZ printers can communicate via Bluetooth with both iOS and Android. You may want to consider integrating the Zebra SDKs into your app and then use it to print the PDF to the QL420+. Another option is to use an app that handles printing from/to these types of devices such as centvia.

There are few variables here: printer (including make/model), communication type (LAN, Bluetooth), and the app platform (iPad, Android, laptop); it would be helpful to reduce the variables. It does not look any change is needed on the laptop since it is working for you. For iPad and Androids, if the variables can’t be reduced, generating a PDF and printing it via what these manufacturers or third parties make available is the only option. There will likely be issues and challenges with page sizes, scaling down and / or cropping the document (typical receipt printer resolution is 200 dpi), and relatively long time to print especially when using Bluetooth (because the document image is sent to the printer); not telling you anything new here, you have already seen some of these issues.

Issues and challenges will be reduced if the variables can be reduced, such as by selecting one printer make/model that works with the communication type you need and for the platforms you want to print from. If you narrow down the printer make to one manufacturer, you may also want to consider generating the receipt in the language of the printer you select (instead of creating a PDF, sending the PDF to the client, having some driver somewhere scale down the document or crop it, and then send the image of the altered document to the printer for printing); it will take less time to print, and it will avoid the scaling, page size and margin issues.

If you end up reducing the variables to Zebra printers and rendering the receipt in their language, then take a look at centvia and contact them to see if they have a solution for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top