Home General

Anyone has experience with printing magnetic bands on Zebra printers?

A user of my end user reporting application uses reportbuider to print on a Zebra XPS series 7.
Report Builder is basically used to print the graphical part (one one side the picture of the employee, the name and some info, on the other side a "if foudn please return to ....") when printing from the preview form he opens printer settings and then goes into the page where he can type(paste in f act) the badge number that he would like to print on the card. Ideally i would like to pass that number from the report to the printer but this seems odd unless i do a custom RB function that uses the dll provided by zebra. Somehow i could register a function in RAP called EncodeMagneticBand(aTextToEncode: string) this could work.

But before starting this exploration I'd like to ask if anyone already used Report Builder to print on a Zebra XPS series 7 or similar printer.
Thanks.

Comments

  • Hi Francesco,

    We've definitely had customers use RB to generate id cards, but we're not aware whether anyone has implemented a Zebra XPS solution for generating magnetic codes.

    I Googled and found this ZMotif SDK+ Delphi example. That would be a good starting point. Test with Delphi code and then as a second step build a RAP pass-thru function.

    https://km.zebra.com/kb/index?page=content&id=SA232&actp=LIST

    Zebra also has a printer control language called ZPL, might be another option. To send control codes to the printer implement the Report.OnPrinterDeviceStateChange event and to call the Report.Printer.SendEscape method.

    Here's an example from the RB Help topic for Report.OnPrinterDeviceStateChange
      
    uses
        ppTypes;
    
    procedure Form1.ppReport1OnPrinterDeviceStateChange(Sender: TObject; aStateChange: TppDeviceStateChangeType);
      begin
        if (aStateChange = dsAfterStartPage) then
          ppReport1.Printer.SendEscape('some escape code here');
    
      end;
    
    Once you implement a solution, perhaps you would like to share by posting a followup here. :smile:

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • Thanks for the reply. I will for sure share my results.

    When you say that SendEscape can be used tosend commands using zebra language you mean that in out code if i replace 'some escape code here' with '^FO50,200^A0N,40,30^BCN,150,Y,N,Y^FD>;>80012345123451234512^FS'
    ?
    I just copied and pasted a random ZPL statement foudn by googling.

    if this is true i could avoid binding to zebra dlls but simply use SendEscape i could communicate to the printer.

    Is this what you told me?

    Thanks.
  • edited April 2018
    Sorry to post again but considering printers are not my domain i hope to get some guidance.

    I copy and paste from the printer documentation:

    With ZXP Series 7Card Printers, we provide support for pass-through magnetic
    encoding commands.
    The application developer or user can use a preamble or Macro to indicate to the driver that the
    data following the Preamble or Macro is to be mag encoded.
    The user can have encoding and printing data on the same card, and the driver will filter out
    the encoding data from the printing data. The user does not have to know job control syntax or
    ZMotif commands to send mag encoding commands to the printer.
    Supported Macro commands are:
    1. C01<Track1 Data>
    C02<Track2 Data>
    C03<Track3 Data>
    2. ${1<Track1 data>}$
    ${2<Track2 data>}$
    ${3<Track3 data>}$
    3. ~1=<Track1 data>
    ~2=<Track2 data>
    ~3=<Track3 data>
    somehow with SendEscape I imagine i should send those commands?

    Customer currentl prints from report builder and in print dialog he opens the printer options and manually fills Track1/2/3 Data fields by pasting a number that is something like '000000000000012324', same value in all 3 tracks.

    So my first instinct is to do something like:

    uses
    ppTypes;

    procedure Form1.ppReport1OnPrinterDeviceStateChange(Sender: TObject; aStateChange: TppDeviceStateChangeType);
    begin
    if (aStateChange = dsAfterStartPage) then
    begin
    ppReport1.Printer.SendEscape('C01<000000000000012324>');
    ppReport1.Printer.SendEscape('C02<000000000000012324>');
    ppReport1.Printer.SendEscape('C03<000000000000012324>');
    end;

    end;


    I hope i expressed my self. THere could be big issues in what I wrote since it is the first timei tackle this kind of tasks. Moreover since it is problematic for me to test (i need to send an exe that the customer can try i cannot connect with my pc and really study what goes on) I'd like to make a small sample that just sends these escapes.

    Could you please guide me a little bit more?

    Thanks a lot.
  • Hi Francesco,

    I recommend purchasing the printer or have the client send it to you. You need the printer for testing. Its up to the printer manufacturer how they implement the functionality.

    The example code you have there looks ok to me, though from the docs I'm not sure whether the angle brackets need to be included - you can try it both ways. Try downloading the printer driver and installing it on your machine. And then in your code, add calls to QueryEscape like this
      if ppReport1.Printer.QueryEscape('C01<000000000000012324>') then
        ppReport1.Printer.SendEscape('C01<000000000000012324>');  
    
    RB has Printer.QueryEscape and Printer.SendEscape methods - which call the Windows API Escape function passing a flag of either QUERYESCSUPPORT or PASSTHROUGH. The QUERYESCSUPPORT will ask the printer to verify whether it supports the specified command and return a boolean result.

    https://msdn.microsoft.com/en-us/library/windows/desktop/dd162701(v=vs.85).aspx

    I also don't know the difference between Zebra 'macros' and ZPL. It might be that you can assign a macro command to the Label.Caption property of a label placed on the report layout and then the printer will detect it. Long shot, but simple enough to give it a try.

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
Sign In or Register to comment.