Recent

Author Topic: LazReport Barcode component  (Read 5290 times)

luca

  • Jr. Member
  • **
  • Posts: 83
LazReport Barcode component
« on: March 16, 2015, 12:01:11 pm »
I found a problem in printing a barcode rotated of 90 or 180 degree.
First line doesn't appear into the generated bitmap.
I fixed this problem by adding two rows in Barcode Unit.

Code: [Select]
unit Barcode;
...
...

procedure TBarcode.DrawBarcode(Canvas: TCanvas);   
...
begin
  xadd := 0;
  orgin.x := FLeft;
  orgin.y := FTop;
  if FAngle=90 then Dec(orgin.y); //<--- ADDED
  if FAngle=180 then Dec(orgin.x); //<--- ADDED
...

Hope this help.-

Regards.
Luca

jesusr

  • Sr. Member
  • ****
  • Posts: 484
Re: LazReport Barcode component
« Reply #1 on: March 28, 2015, 05:29:15 am »
what barcode type, any?, do you have a sample report? do you have a screenshot of the bad barcode compred with a good barcode?.

boznz

  • Newbie
  • Posts: 4
Re: LazReport Barcode component
« Reply #2 on: October 01, 2015, 09:32:28 am »
Bit Late, but I Can confirm using code 128A and Ver 1.4 of lazarus the rotated barcodes do not work, the leading bar seems shorter as the poster suggested. Making the change fixed the Problem for me too.

mirce.vladimirov

  • Sr. Member
  • ****
  • Posts: 256
Re: LazReport Barcode component
« Reply #3 on: January 15, 2021, 05:15:02 pm »
Than you Luca, your trick helped me, added those two lines in that file and compiled my project, but not Lazarus.
Except, in my case the procedure was named TBarcode.DoLines(Data: string; Canvas: TCanvas);   
I use Lazarus 1.4.4 and the Lazreport that came with it.


sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
Re: LazReport Barcode component
« Reply #4 on: January 15, 2021, 05:27:46 pm »
Lazarus is now at version 2.0.10!!! Yours is old. And i think it's maybe fixed meanwhile?
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

dseligo

  • Hero Member
  • *****
  • Posts: 1196
Re: LazReport Barcode component
« Reply #5 on: January 15, 2021, 11:05:48 pm »
Lazarus is now at version 2.0.10!!! Yours is old. And i think it's maybe fixed meanwhile?
It's not fixed, I just checked. And when it's rotated to 270 degree, barcode is correct but text isn't showing.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: LazReport Barcode component
« Reply #6 on: January 16, 2021, 06:43:09 am »
hello,
Lazarus is now at version 2.0.10!!! Yours is old. And i think it's maybe fixed meanwhile?
It's not fixed, I just checked. And when it's rotated to 270 degree, barcode is correct but text isn't showing.
i don't know why there is this code in the procedure TfrCustomBarCodeView.DrawLabel of the lr_barc.pas file of lazreport :
Code: Pascal  [Select][+][-]
  1.  
  2.           else  //  Param.cAngle = 270
  3.           begin
  4.             Brush.Color:=clWhite;
  5.             Brush.Style:=bsSolid;
  6.             Font.Orientation := 2700;
  7.             if (WidgetSet.LCLPlatform = lpGtk2) and IsPrinting then
  8.             TextOut(R.Left + fs, R.Top + (dy -TextWidth(FText)) div 2, FText)                                          
  9.           end;

with this code rotate barcode by 270°  works  on windows 10 :

Code: Pascal  [Select][+][-]
  1. else
  2.           begin
  3.             Brush.Color:=clWhite;
  4.             Brush.Style:=bsSolid;
  5.             Font.Orientation := 2700;
  6.             FillRect(Rect(R.Left,R.Top,R.Left + fs,R.Bottom));
  7.            TextOut(R.Left + fs, R.Top + (dy -TextWidth(FText)) div 2, FText);
  8.           end;
  9.  

Friendly, J.P
« Last Edit: January 16, 2021, 06:45:26 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

 

TinyPortal © 2005-2018