1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP to print barcodes via ZPL

Discussion in 'PHP' started by stephan2307, May 28, 2010.

  1. #1
    Hi,
    SEMrush
    I wonder if it is possible to get php to interact with a networked barcode printer using the ZPL barcode language.

    Has anyone ever tried this?

    Does someone have any info / tutorials / or anything else?
     
    stephan2307, May 28, 2010 IP
    SEMrush
  2. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The PHP Printer Interface is Windows-only, but anyway, you can output ZPL to the browser or to a file and then print it. Or write it directly to the printer with linux.

    An example to print a label for a cookbook on lp0 with linux:
    
    $labelcode =<<<AAA
    ^XA
    ^LH0,0
    ^FO40,100^FH\^A0N,50,40^FDCookbook II^FS
    ^FO40,150^CI7^FH\^A0N,30,30^FDFrom Alice Cooker^FS
    ^FO40,180^BY3,2^BCN,150,N,N^FD1234567890ABC^FS
    ^PQ1
    ^XZ
    AAA;
    file_put_contents('/dev/lp0',$label);
    
    Code (markup):
    Btw. if you need zebra printer(s) drop me a line.
     
    Last edited: May 28, 2010
    flexdex, May 28, 2010 IP
  3. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,231
    Likes Received:
    22
    Best Answers:
    7
    Trophy Points:
    140
    #3
    We already have one thanks though.

    Basically I need to be able to print barcodes from the custom written web based application. I have a windows and a linux server available. This needs to be done from different computers on a networked printer without that browser print dialog.

    What would be the best way to do it?
     
    stephan2307, May 28, 2010 IP
  4. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    1.) write that ZPL to a unique file or a database
    2.) have a cronjob print that
     
    flexdex, May 29, 2010 IP