Nice, made a proof of concept for generating native Zebra label printer commands (ZPL) from FastReport (this is much faster and sharper than Windows printing)

Nice, made a proof of concept for generating native Zebra label printer commands (ZPL) from FastReport (this is much faster and sharper than Windows printing)
http://en.wikipedia.org/wiki/Zebra_(programming_language)
http://www.zebra.com/id/zebra/na/en/documentlibrary/manuals/en/zpl_ii_programming2.File.tmp/45541L-002_RA.pdf

    for i := 0 to page.Objects.Count - 1 do
    begin
      c := TObject(page.Objects[i]) as TfrxComponent;
      if c is TfrxMemoView then
      begin
        fm := (c as TfrxMemoView);
        x := Round(fm.Left);  //is in pixels
        y := Round(fm.Top);
        raw.DrawLabel(x, y, Trim(fm.Text), Abs(fm.Font.Height), fm.Font.Size);
      end

...

procedure TRAWLabel.DrawLabel(x,y: Integer; const Text: string; aHeight: Integer = 20; aWidth: Integer = 20);
 begin
 FData.Add( Format('^FO%d,%d^ADN,%d,%d^FD%s^FS',
                   [x, y, aHeight, aWidth, Text]) );
 end;

Note: ZPL positioning works with pixels, FastReport components also have pixel based positions so it should be "exact the same" (only the font can be different)
http://www.zebra.com/id/zebra/na/en/documentlibrary/manuals/en/zpl_ii_programming2.File.tmp/45541L-002_RA.pdf

Comments

  1. I am using Delphi 6,7 xe can i apply your concept to them?
    And if yes can you show a REAL test PROGRAM to test the concept?
    On xe i have fast report 4
    Now i use BarTender Suite and Delphi

    ReplyDelete
  2. shlomo abuisak yes I think I can make it, but not this week I'm afraid. But for raw printing you need to write specific codes, e.g. for Zebra label printers it is ZPL but other brands have their own. So are you using Zebra right now?

    ReplyDelete
  3. Yes. with bar tender. i will be glad to see a demo program
    my mail is 
    limelect  at gmail dot com   or publish it here thanks

    ReplyDelete
  4. shlomo abuisak sorry for the delay, but I could test it only lately on a real zebra printer. Font is still not perfect (each font has it own scaling?) but at least it is possible :) 
    https://github.com/andremussche/AndrewsDelphiStuff/tree/master/FastReport2ZebraZPL

    ReplyDelete
  5. Right now I am developing a small program for Intermec
    Pc4 with Delphi,
    It workers in raw printer mode. I have only a small problem of sending graphics to it.
    1. If you want this pease of program?
    2 I have a nice idea to make labeled with delphi
    If you want to here about it get in touch
    Limelect at gmail dot com

    ReplyDelete
  6. shlomo abuisak sorry, I don't have right now because we won't continue (at least for now) with raw mode, because with FastReport it is fast enough and better font support (default zebra fonts are ugly)

    ReplyDelete

Post a Comment