Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: FastReport and barcode object



Permlink Replies: 0
Fred Fonar

Posts: 137
Registered: 3/16/00
FastReport and barcode object
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 27, 2016 12:50 PM
I have some issues with barcode object:
1. If I set zoom to less than 1 (eg 0.5) then barcode reader cannot read barcode
2. If I paint barcode to timage component using bitmap the result is also not recognized. I marked Draw routine to mention that I need shift barcode up 15 pixels as white space on top. Source below:

procedure TFormPrintProduct.PrintSerialNoAfterPrint(
Sender: TfrxReportComponent);
var
tmpBRC: TfrxBarCodeView;
PxCm: Double;
tmpBmp: TBitmap;
begin
tmpBRC := TfrxBarCodeView(PrintSerialNo.FindObject('BarCode1'));
PxCm := Round(PrintSerialNo.Font.PixelsPerInch / 2.54);//Px in cm on
tmpBmp := TBitmap.Create;
tmpBmp.PixelFormat := pf32bit;
tmpBmp.SetSize(Round(tmpBRC.Width * PxCm / tmpBRC.Zoom), Round(tmpBRC.Height * PxCm / tmpBRC.Zoom));
tmpBRC.Draw(tmpBmp.Canvas, 1.0, 1.0, 0.0, -15.0);
Image1.Picture.Assign(tmpBmp);
tmpBmp.Free;
end;

Print below:
Bits := Image1.Picture.Bitmap.Handle;
GetDIBSizes(Bits, InfoSize, ImageSize);
Info := AllocMem(InfoSize);
try
Image := AllocMem(ImageSize);
try
GetDIB(Bits, 0, Info^, Image^);
with Info^.bmiHeader do
begin
DIBWidth := biWidth;
DIBHeight := biHeight;
end;
newWidth := 5 * DIBWidth;
newHeight := 5 * DIBHeight;
StretchDIBits(Canvas.Handle, 80, Y + 80, newWidth, newHeight, 0, 0,
DIBWidth, DIBHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY);
finally
FreeMem(Image, ImageSize);
end;
finally
FreeMem(Info, InfoSize);
end;

3. How can I only generate report without showing it?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02