Integration of GS1-128 Data Matrix Barcode in FR VCL 5

Hello,


we are using Fast Report VCL 5.

We want to create a Label within Fast Report with a GS1-128 Data Matrix Code for a product label.

Is this possible and how?


Regards


Thomas

Comments

  • Find barcode component with GS1-128 Datamatrix barcode support, generate barcode as image and then use this image in the TfrxPictureView. Try also to use FR 6

  • Hello there,

    do you have an example how I can do this?


    I asked some developers and they said i shall buy the Font from https://www.idautomation.com/barcode-fonts/2d/datamatrix/ and then build the Barcode within the script of fast report. I need a barcode with GS1-128 Rule and FNC1. Is this possible? And if it is possible how can it be done.


    I`m no developer, so thanks for further instructions.

  • unit Unit1;


    interface


    uses

     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

     Dialogs, StdCtrls, frxClass, frxDesgn;


    type

     TForm1 = class(TForm)

       Edit1: TEdit;

       ComboBox1: TComboBox;

       Button1: TButton;

       Label1: TLabel;

       ComboBox2: TComboBox;

       Label2: TLabel;

       Label3: TLabel;

       CheckBox1: TCheckBox;

       Memo1: TMemo;

       Label4: TLabel;

       ComboBox3: TComboBox;

       frxReport1: TfrxReport;

       frxDesigner1: TfrxDesigner;

       procedure Button1Click(Sender: TObject);

       procedure FormCreate(Sender: TObject);

     private

       { Private declarations }

     public

       { Public declarations }

     end;


     procedure DMEncode(Message_: String; Mode: Byte; PreferredFormat: Byte; HandleTilde: Boolean); stdcall; external 'DataMatrixFont.dll';

     function DMGetRows: integer; stdcall; external 'DataMatrixFont.dll';

     function DMGetCols: integer; stdcall; external 'DataMatrixFont.dll';

     function DMGetCharAt(RowIndex: Integer; ColIndex: Integer): integer; stdcall; external 'DataMatrixFont.dll';


    var

     Form1: TForm1;


    implementation


    {$R *.dfm}


    procedure TForm1.Button1Click(Sender: TObject);

    var Message_, EncodedMsg: string;

       Mode, PreferredFormat: Byte;

       i, j, RowCount, ColCount: Integer;

       HandleTilde: Boolean;

       Memo: TfrxMemoView;

    begin

       Message_ := Edit1.Text;

       Mode := ComboBox1.ItemIndex;

       PreferredFormat := ComboBox2.ItemIndex;

       HandleTilde := CheckBox1.Checked;

       DMEncode(Message_, Mode, PreferredFormat, HandleTilde);

       Memo1.Text := '';

       Memo1.Font.Name := 'MW6 Matrix';

       Memo1.Font.Size := StrToInt(ComboBox3.Text);

       RowCount := DMGetRows;

       ColCount := DMGetCols;

       EncodedMsg := '';

       for i := 1 to RowCount do

         begin

           for j := 1 To ColCount do

             EncodedMsg := EncodedMsg + Chr(DMGetCharAt(i - 1, j - 1));

           EncodedMsg := EncodedMsg + #13#10;

         end;

       Memo1.Text := EncodedMsg;

       Memo := TfrxMemoView(frxReport1.FindObject('Memo1'));

       Memo.Font.Name := 'MW6 Matrix';


       Memo.Font.Size := StrToInt(ComboBox3.Text);

       Memo.Text := EncodedMsg;

       case Memo.Font.Size of

         8 : Memo.LineSpacing := -2;

         9, 10, 11, 12 : Memo.LineSpacing := -3;

         14 : Memo.LineSpacing := -4;

         16, 18 : Memo.LineSpacing := -5;

         20, 22 : Memo.LineSpacing := -6;

       end;

       Memo.GapY := 0;

       Memo.GapY := 0;

       Memo.Wysiwyg := false;

       frxReport1.ShowReport();

    end;


    procedure TForm1.FormCreate(Sender: TObject);

    begin

        ComboBox1.Text := ComboBox1.Items.Strings[0];

        ComboBox2.Text := ComboBox2.Items.Strings[0];

        ComboBox3.Text := '12';

    end;


    end.

Leave a Comment