Recent

Author Topic: How to insert GS1-128 barcode on report?  (Read 2987 times)

KaYs3r

  • New member
  • *
  • Posts: 8
How to insert GS1-128 barcode on report?
« on: June 13, 2024, 01:44:46 pm »
Hi everyone,

I'm trying to insert a GS1-128 barcode on a report for label printing, but it doesn't work.
If I use Laz Barcodes components, I can create the barcode correctly, but it shows a black rectangle on the report.

Can someone point me in the right direction please?

Thanks

dseligo

  • Hero Member
  • *****
  • Posts: 1412
Re: How to insert GS1-128 barcode on report?
« Reply #1 on: June 13, 2024, 03:39:30 pm »
Do you use LazReport?

If yes, then you can put bitmap to picture in report like this:
Code: Pascal  [Select][+][-]
  1.     var frQR: TfrObject;
  2.         Bmp: TBitmap;
  3.  
  4.     ... // create and fill bitmap
  5.  
  6.       frQR := frReport1.FindObject('Picture1'); // 'Picture1' is name of picture in report where barcode will be shown
  7.       If frQR = nil then Exit;
  8.       If not (frQR is TfrPictureView) then Exit;
  9.      
  10.       (frQR as TfrPictureView).dx := Bmp.Width; //Width
  11.       (frQR as TfrPictureView).dy := Bmp.Height; //Height
  12.       (frQR as TfrPictureView).Picture.Bitmap := Bmp;
  13.  
  14.     ... // free bitmap

Ask if you need help with creating bitmap from LazBarcode.

paweld

  • Hero Member
  • *****
  • Posts: 1268
Re: How to insert GS1-128 barcode on report?
« Reply #2 on: June 14, 2024, 07:03:28 am »
Sample (for LazReport and LazBarcodes) in attachment
Best regards / Pozdrawiam
paweld

KaYs3r

  • New member
  • *
  • Posts: 8
Re: How to insert GS1-128 barcode on report?
« Reply #3 on: June 14, 2024, 06:44:14 pm »
Sample (for LazReport and LazBarcodes) in attachment

Hey paweld,

Thank you for your sample, but the barcode that is generated is not a valid GS1-128 barcode, it reads as a Code128 type.

KaYs3r

  • New member
  • *
  • Posts: 8
Re: How to insert GS1-128 barcode on report?
« Reply #4 on: June 14, 2024, 06:58:52 pm »
OK paweld,

I've managed to change your code to make the GS1-128 Code :)

Thanks

KaYs3r

  • New member
  • *
  • Posts: 8
Re: How to insert GS1-128 barcode on report?
« Reply #5 on: June 17, 2024, 05:00:07 pm »
So...

I've managed to add the barcodes to a report and print it. But the quality is very poor.
I want to print to a label printer, and the barcodes are really hard to read.

Is there any configuration for the quality?

Thanks

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: How to insert GS1-128 barcode on report?
« Reply #6 on: June 17, 2024, 10:31:48 pm »
The quality depends on the font you are using.
It needs to explicitly support gs1-128.
Usually the hardware supplier has such fonts available, but many are free.
« Last Edit: June 17, 2024, 10:40:49 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

KaYs3r

  • New member
  • *
  • Posts: 8
Re: How to insert GS1-128 barcode on report?
« Reply #7 on: June 18, 2024, 09:54:27 am »
The quality depends on the font you are using.
It needs to explicitly support gs1-128.
Usually the hardware supplier has such fonts available, but many are free.

Hi Thaddy,

I'm using an image, not a font. If I used a font, quality would not be an issue, but unfortunatly, I can't use font with reports, only images :\

Thanks

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: How to insert GS1-128 barcode on report?
« Reply #8 on: June 18, 2024, 10:08:25 am »
Why can't you use barcode fonts with (any report engine) reports? I have been doing that for ages and I wrote for barcode scanners since 1996 and for DOS. I really do not understand your question anymore after that reply.
Back in the days that was way more difficult. (or simpler, just use prn)

To do it properly, you need a proper font and things become very easy.
« Last Edit: June 18, 2024, 10:16:12 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: How to insert GS1-128 barcode on report?
« Reply #9 on: June 18, 2024, 10:15:28 am »
I'm using an image, not a font. If I used a font, quality would not be an issue, but unfortunatly, I can't use font with reports, only images :\
Going with that line of thought (which is wrong btw): images (usually a bitmap) can be used to draw text using .... surprise... a font :)
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: How to insert GS1-128 barcode on report?
« Reply #10 on: June 18, 2024, 10:22:37 am »
That is, it seems he needs OCR in his code?
If I smell bad code it usually is bad code and that includes my own code.

KaYs3r

  • New member
  • *
  • Posts: 8
Re: How to insert GS1-128 barcode on report?
« Reply #11 on: June 18, 2024, 10:39:58 am »
Why can't you use barcode fonts with (any report engine) reports? I have been doing that for ages and I wrote for barcode scanners since 1996 and for DOS. I really do not understand your question anymore after that reply.
Back in the days that was way more difficult. (or simpler, just use prn)

To do it properly, you need a proper font and things become very easy.

How can I do that? Can you give me a sample?
I'm doing like paweld sugested.

Thanks

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: How to insert GS1-128 barcode on report?
« Reply #12 on: June 18, 2024, 10:56:13 am »
@Thaddy I assume that TS most probably has a scaling issue.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: How to insert GS1-128 barcode on report?
« Reply #13 on: June 18, 2024, 12:24:36 pm »
 :D
Good fonts scale...
If I smell bad code it usually is bad code and that includes my own code.

paweld

  • Hero Member
  • *****
  • Posts: 1268
Re: How to insert GS1-128 barcode on report?
« Reply #14 on: June 18, 2024, 01:27:45 pm »
Quote from: KaYs3r
So...

I've managed to add the barcodes to a report and print it. But the quality is very poor.
I want to print to a label printer, and the barcodes are really hard to read.

Is there any configuration for the quality?
What type of code are you using? What is the scale of the barcode? What is the width of the label? Provide some examples of the codes you are trying to print, and preferably share a sample project, because for now there is too little information to check and advise anything.
Best regards / Pozdrawiam
paweld

 

TinyPortal © 2005-2018