Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks,

I would like to use Perl to create labels with text and barcodes and print them immediately on a QL-570 printer. So far I have not done well at finding bar code packages for Perl and I have found NOTHING to help me write directly to the printer. I can use the CODE128 specification and generate my own bar codes using PerlMagick but I am totally lost when it comes to writing to the printer. I can not find example using Perl and I don't even know if the printer is PostScript or another format.

Thank you,
Bruce

Replies are listed 'Best First'.
Re: using Brother QL-570 printer with Perl
by ww (Archbishop) on Aug 03, 2011 at 01:01 UTC
    So, among many other 'gimme's, you expect the Monks to research this (implicit) OT question: 'what sort of protocol does a Brother QL-570 printer respond to?'

    For that, you'll do far better asking Brother; searching their website (yes, they most definitely have one), and, if necessary, then searching farther.

    As for printing with Perl -- the command print is quite well explained in documents which exist -- in almost every case -- on any computer with Perl. Try perldoc -f print at the command prompt.

    Finally, feed Google "site:CPAN.org barcode" and find many modules for dealing with barcodes. Or, if you're using ActiveState's distribution, try ppm search barcode at the command prompt. For my (win32) Perl 5.12.4, that returns more than a dozen candidates, some of which may even be relevant to your needs.

      No, I don't expect the Monks to do my research for me. When I have had experience with something and see a question I often take the time to share my experience or give a suggestion or two. Often a "try this" or "I don't think you are looking at this the right way" can be very helpful.

      I have spent about 30 minutes doing a Google search and so far have only found "use this Windows program" types of solutions. Trying to use custom written Perl code under Linux I have not found anything helpful.

      Brother does not seem to have a phone number to call for these types of questions. I have posted a question on their web site. The web site states that it often takes 3 days to get a response. Since I will probably get a "use Windows software" answer from the India contact center I am looking for answers elsewhere.

      I will do a little more searching on Perl support of barcodes but if I can't talk to the printer it will be a waste of time. I don't have a clue if sending data to a USB connected barcode printer is easy or not. So far getting information is not easy and getting help is not working out too well. I'm pretty sure I can "roll my own" barcodes with about 2 hours of programming. It often takes me more than 2 hours to take the "easy" path of downloading something and then trying to get it to work.

      Once again I am faced with the question authoring problems. If I ask a short question I get attacked for not doing my own work. If I ask a long question with lots of details and demonstration of work I bore people and give some lots to shoot at. When I go for the middle ground it doesn't seem to work well either. The engineering Q&A sites seem to have the same problem so I guess that is the way it has to be.

      Bruce

        It might or might not be useful to do some more research into the printer and its surrounding infrastructure. If the printer is accessed through a serial connection over USB, you might get lucky and be able to use whatever serial printing protocol is available. Maybe even using PCL5 already is enough.

        If the printer uses a custom USB protocol, you're lost unless you can reverse engineer the (Windows) printer driver or find out how to make a Windows printer driver work with CUPS, much like ndiswrapper does for Windows network card drivers.

        Actually, IMO, your response still indicates that you expect others to do your work for you. If clarification of that is needed, consider:

        printing your barcode labels to the particular printer is your project; not ours; not Google's or Bing's or Yahoo's; not Brother's; and (repeat not ours. PM exists to help folks (who help themselves) learn Perl; not to solve incidental and OT problems like attaching a printer.

        For example, you say you telephoned Brother. Why not search the web for the manual and find at least some of your answers there. Feeding Google the search terms "Brother QL-570 manual" will produce any number of hits... the first of which (after the paid ads) are:

        1. Professional Label Printer | Office – Brother QL 570 www.brother-usa.com/labelprinter/modeldetail.aspx?...QL570 - Cached Brother International in the United States - At Your Side. Global Site ... Why a Brother? How do I use it? Features Buying Guide · Applications · Register for updates ... Brother QL-570. Professional Label Printer ... Specifications - Supplies & Accessories
        2. PDF Brother QL-570 Label Printer Manual - CompUSA static.compusa.com/pdf/Brother-QL-570-Label-Printer-Manual.pdf File Format: PDF/Adobe Acrobat - Quick View About This Guide. 3. Introduction. The Brother QL-570 label printer (hereafter referred to as "the machine") enables you to quickly and easily ...

        And why are you letting an assumption (almost certainly incorrect) -- namely, that sending data to a USB printer from Perl requires somethingthing more arcane than sending data to any other printer -- stand in the way of checking that manual and your OS documents?

        Officially, this isn't a 'No Whine Zone'... but doing so tends to produce less satisfactory results than obtain when you read and consider implementing the suggestions -- implied or otherwise -- from respondents.

      Reply received from Brother

      Customer Service TN custsrv@brother.com to me

      show details 10:37 AM (3 hours ago)

      Dear Brother Customer,

      Unfortunately, there is no technical manual available for this model.
      Thank you for your inquiry.
Re: using Brother QL-570 printer with Perl
by dasgar (Priest) on Aug 03, 2011 at 15:20 UTC

    As for generating bar codes in Perl, I've had good success using GD::Barcode to create bar code images. It's very simple and straight forward in my opinion.

    As for having Perl print directly to the printer, in less than 5 minutes I found the following link: http://www.brother.com/product/dev/label/bpac/index.htm

    That link is for the SDK package from Brother for their devices. With the C++ portion of that package, I think you should be able to use something like one of the inline modules or use Win32::API if they provide a DLL.

    Also, it sounds like that SDK package includes stuff to allow you to create a way to print directly from Excel or Access. That leads me to believe that you can set that up and potentially use Win32::OLE to enter data (including bar codes) into Excel or Access and print from there.

    Hopefully this information gets you headed down the right path.

      Thank you for the GD::Barcode suggestion. I'll look into it.

      I'm sorry but I forgot to include in my initial posting that I am using Linux. I'm sure your other suggestions are very good but they seem to be Windows oriented.

      Thank you,
      Bruce

        Is Linux a supported OS for this printer?

        Also note that this is Perlmonks, not Linuxmonks. If your printer has no driver already, it's highly unlikely that somebody will write a printer driver in Perl.

        My suggestion is to either first get the setup working on Windows and then worry about how to make the setup work under Linux (if ever), or to first buy hardware that has vendor support for Linux, and then work from there.

        When asking for help with communicating with devices, it's usually a good idea to mention which OS you're working with. Since Brother's website was primarily listing Windows stuff for your device, I made the assumption that you were on Windows.

        Doing a quick Google search on "Brother QL-570 linux" yielded this link: http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/index.html

        I'm not very experienced with Linux, but I think that if you're able to manually print to the device from the terminal (lpr command?), it should be easy to issue a system call from Perl to do the same. Also, on that page, one of the links describes how to print from OpenOffice and Gimp. If you can find a way to control those programs from Perl, that should give you another route to go.