Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Problem mit Zint Barcode-Generator (https://www.delphipraxis.net/153969-problem-mit-zint-barcode-generator.html)

Oliver Voß 23. Aug 2010 13:23

Problem mit Zint Barcode-Generator
 
Moin Forum,

ich probiere mal grade wieder mit Datamatrix-Codes in Verbindung mit Zint
Wenn ich diesen Barcode eingebe: 123456789012345
dann wird der Datamatrix-Code nicht mehr quadratisch sondern rechteckig (Seitenverhältnis 2:1) dargestellt. Ein paar Zeichen mehr oder weniger dann sieht es gut aus.
In dem Programm "Zint Barcode Studio" wird es immer richtig dargestellt.
Delphi-Quellcode:
 
var myBmp        :TBitMap;
    ZintBarcode1  :TZintBarcode;

begin
  myBmp :=TBitmap.Create;

  ZintBarcode1.Clear;
  ZintBarcode1.Data := Edit1.Text;

  ZintBarcode1.BarcodeType := tBARCODE_DATAMATRIX;
  ZintBarcode1.GetBarcode(myBmp);
  Image1.Picture.Bitmap := myBmp;

  myBmp.Free;
end;
Mache ich irgendetwas falsch? Oder fehlt etwas?

chaosben 24. Aug 2010 06:38

AW: Problem mit Zint Barcode-Generator
 
Naja ... ich gebe zu, das ist wenig tricky, aber vom Entwickler so geplant.
Zitat:

Zitat von http://www.zint.org.uk/zintSite/Manual.aspx?page=11
An extra feature is available for Data Matrix symbols which allows Zint to automatically resize the symbol as required but also prevents Zint from using rectangular symbols. To set this mode at the command line use the option --square and when using the API set the value option_3 = DM_SQUARE

Lange Rede kurzer Sinn:
Delphi-Quellcode:
var myBmp :TBitMap;
    ZintBarcode1 :TZintBarcode;
begin
  ZintBarcode1 := TZintBarcode.Create;
  myBmp :=TBitmap.Create;

  ZintBarcode1.BarcodeType := tBARCODE_DATAMATRIX;
  ZintBarcode1.Option3 := 100;
  ZintBarcode1.Data := '123456789012345';
  ZintBarcode1.GetBarcode(myBmp);
  Image1.Picture.Bitmap := myBmp;

  ZintBarcode1.Free;
  myBmp.Free;
end;

khh 24. Aug 2010 09:19

AW: Problem mit Zint Barcode-Generator
 
hallo zusammen,
die Einbindung von Zint zum Barcoddruck intressiert mich auch.
Leider konnte ich nur C++ Bibliotheken im Downloadbereich finden.
Dem obigen Beispiel nach muss es die aber auch für Pascal geben.
Bin ich blind, oder steh ich auf der Leitung? ;-)

Danke gruss KHH

mkinzler 24. Aug 2010 09:22

AW: Problem mit Zint Barcode-Generator
 
http://www.delphipraxis.net/143986-%...lphi-zint.html

khh 24. Aug 2010 09:41

AW: Problem mit Zint Barcode-Generator
 
Zitat:

Zitat von mkinzler (Beitrag 1044502)

ich danke dir

Gruss KHH

Oliver Voß 13. Apr 2011 08:39

AW: Problem mit Zint Barcode-Generator
 
Moin Forum,

ich habe noch mal ein Problem mit Zint.

Ich wollte gestern noch mal etwas rumprobieren und bin jetzt auf ein Problem gestoßen.
Delphi-Quellcode:
procedure ZeichneDatamatrix;
var
  myBmp           :TBitMap;
  myZintBarcode   :TZintBarcode;
begin

  myZintBarcode    := TZintBarcode.Create;
  myBmp            := TBitmap.Create;


  myZintBarcode.Clear;
  myZintBarcode.BarcodeType := tBARCODE_DATAMATRIX;
  myZintBarcode.Option3     := 100;
  myZintBarcode.Scale      := 1;
  myZintBarcode.Data       := EditBarcode.Text;
  myZintBarcode.GetBarcode(myBmp);
  Form1.Canvas.Draw(0,0,myBmp);



  myBmp.Free;
  myZintBarcode.Free;
  end;
Wenn ich diesen Code ausführen lasse, dann bekommen ich eine Fehlermeldung: "Im Projekt XY ist eine Exception der Klasse EOutOfResources mit der Meldung 'Systemresourcen erschöpft.' aufgetreten."

In der Zint-Unit uZintInterface.pas in der Prozedur ZBarcodeToBitmap
Delphi-Quellcode:
procedure ZBarcodeToBitmap(ASymbol : PZSymbol; const ABitmap : TBitmap);
var
  //bmpinfo : TBitmapInfo;
  myp : PRGBTriple;
  row : Integer;
  rowwidth : Integer;
begin
  ABitmap.PixelFormat := pf24bit;

  ABitmap.SetSize(ASymbol.bitmap_width, ASymbol.bitmap_height);
hat ASymbol.bitmap_width einen Wert von 1311800 und ASymbol.bitmap_height 1310720.
Wie kommt es, dass dort solche großen Werte stehen? Der zu codierende Text war in diesem Beispiel "4455".

Gruß Oliver


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:40 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz