Recent

Author Topic: Zebra printer and LazReport problem (Solved)  (Read 431 times)

tito_livio

  • Newbie
  • Posts: 3
Zebra printer and LazReport problem (Solved)
« on: February 18, 2025, 08:41:21 pm »
Hi,
I use LazReport to print labels with a Zebra printer in some of my Windows programs.
The label format consists of two or three lines of text and a 1D barcode.
When I used Lazarus 2.0.6, everything worked fine, and the label printing was successful, adapting correctly to the 50x30 mm label format. With newer versions of Lazarus (from 2.2.4 onward, including the latest 3.8 ), the label is printed as just a thin strip of a few millimeters.
I have attached a scan showing a test printout of the labels using both versions of Lazarus: 2.0.6, which worked correctly, and 3.8, which does not.
Additionally, I have included a simple project related to this printing issue.
I also noticed that if I run the print job in preview mode and then open and close the printer properties window without making any changes, the print works correctly.
Of course, users cannot be expected to perform this procedure for every single label they print.
Thank you in advance.
« Last Edit: March 20, 2025, 03:56:03 pm by tito_livio »

tito_livio

  • Newbie
  • Posts: 3
Re: Zebra printer and LazReport problem
« Reply #1 on: March 20, 2025, 03:55:17 pm »
I created a bug report for this issue and I received this answer:

Try modify your code in this way:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   frReport1.LoadFromFile('stampa_ETIC.lrf');
  4.   // set the custom paper size (256) with dimensions 50mm (50*10) x 30mm (30*10)
  5.   // add this line:
  6.   frReport1.Pages[0].ChangePaper(256, 500, 300, poPortrait);
  7.   //and this line - set margins to 0
  8.   frReport1.Pages[0].Margins.AsRect := Rect(0, 0, 0, 0);
  9.   frReport1.PrepareReport;
  10.   frReport1.PrintPreparedReport('1', 1);
  11. end;  

and it works now.

The original code was:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   frReport1.LoadFromFile('stampa_ETIC.lrf');
  4.   frReport1.PrepareReport;
  5.   frReport1.PrintPreparedReport('1', 1);
  6. end;

 

TinyPortal © 2005-2018