Jump to content

wsian

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by wsian

  1. Has anyone able to use latest zint.dll (v2.11) for printing barcode? I'm only able to use up to v2.6.1 to get the barcode. Version beyond that will just print out a blank image.
  2. wsian

    Zint barcode studio zint.dll

    Alternately, you can use Zint-Barcode-Generator-for-Delphi by landrix (no dll needed). Just that the last updated version has an issue. The linear barcode (code128 etc) has been squeezed to 1/3 or even 1/5 block height. Not sure when it will be corrected.
  3. wsian

    Zint barcode studio zint.dll

    Download the latest zint.dll (v2.11) from here https://sourceforge.net/projects/zint/ I'm only using ZBarcode_Encode_and_Buffer. If you need to use other function, please adjust the zint.pas accordingly. Sample code as below: procedure ZBarcode_To_Bitmap(symbol: PZint_Symbol; const ABitmap: TBitmap); var SrcRGB: PRGBTriple; Row, RowWidth: Integer; begin ABitmap.PixelFormat := pf24bit; ABitmap.SetSize(symbol.bitmap_width, symbol.bitmap_height); SrcRGB := Pointer(symbol.bitmap); RowWidth := symbol.bitmap_width * 3; for Row := 0 to symbol.bitmap_height - 1 do begin CopyMemory(ABitmap.ScanLine[Row], SrcRGB, RowWidth); Inc(SrcRGB, symbol.bitmap_width); end; SetBitmapBits(ABitmap.Handle, symbol.bitmap_width * symbol.bitmap_height * 3, symbol.bitmap); end; procedure TForm1.Button2Click(Sender: TObject); var lvSymbol : Pzint_symbol; lvErrorNumber: Integer; lvData: UTF8String; lvBitMap: TBitmap; lvErrorText: string; begin lvSymbol := ZBarcode_Create(); if lvSymbol = nil then Exit; lvBitMap := TBitmap.Create; try lvSymbol.symbology:= BARCODE_QRCODE; lvSymbol.input_mode := DATA_MODE ; lvData := utf8string(Edit1.Text); lvErrorNumber := ZBarcode_Encode_and_Buffer(lvSymbol, PAnsiChar(lvData), Length(lvData), 0); if lvErrorNumber = 0 then begin ZBarcode_To_Bitmap(lvSymbol, lvBitMap); ZBarcode_Print(lvSymbol,0) ; Image1.Picture.Bitmap.Width := Image1.Width; Image1.Picture.Bitmap.Height := Image1.Height; Image1.Picture.Bitmap.Canvas.Brush.Color := clWhite; Image1.Picture.Bitmap.Canvas.FillRect(Rect(0, 0, Image1.Width, Image1.Height)); Image1.Picture.Bitmap.Canvas.StretchDraw(Rect(10, 10, Image1.Width - 10, Image1.Height - 10), lvBitMap); end else begin Image1.Picture.Bitmap.Width := Image1.Width; Image1.Picture.Bitmap.Height := Image1.Height; Image1.Picture.Bitmap.Canvas.Brush.Color := clWhite; Image1.Picture.Bitmap.Canvas.FillRect(Rect(0, 0, Image1.Width, Image1.Height)); lvErrorText := String(AnsiString(lvSymbol.errtxt)); ShowMessage('barcode error:' + lvErrorText); end; finally lvBitMap.Free; lvBitMap := nil; ZBarcode_Delete(lvSymbol); end; end; zint.pas
  4. wsian

    Zint barcode studio zint.dll

    managed to find Chet - C Header Translator for Delphi to translate zint.h to zint.pas. With minimum adjustment, able to up and run the barcode with latest version.
×