Solved

Delphi 2007 printer setup problem

Posted on 2013-11-26
8
771 Views
Last Modified: 2013-12-01
Hi All,

i am using delphi 2007 and try to print barcodes and A4 pages on tlp2844 zebra and hp 1020.
My problem is, when i switch the printerindex to the 1020 from the 2844, then the printed a4 page is OK, but when i switch back to the 2844, the barcode is faulty, because the page size remains the A4.

I have tried some workarounds, but can't resolve it.

need help
thank you
0
Comment
Question by:RT_
  • 4
  • 4
8 Comments
 
LVL 26

Expert Comment

by:Sinisa Vuk
ID: 39677236
how you print barcode? using quickreport?
0
 

Author Comment

by:RT_
ID: 39677258
nope
here is the code


Printer.BeginDoc;
Printer.Canvas.TextOut(0,128,leftstr(VarToStr(DBGrid3.DataSource.DataSet.FieldByName('NAME').Value),25));
Printer.Canvas.TextOut(0,155,'www.microstore.hu/'+DBtext4.Caption);

Barcode1D_Code1281.Barcode := VarToStr(DBGrid3.DataSource.DataSet.FieldByName('VONALKOD_SN').Value);
Barcode1D_Code1281.Print(2,-3,1,30,17,0);
Printer.EndDoc;
0
 
LVL 26

Expert Comment

by:Sinisa Vuk
ID: 39677339
This component (Barcode1D_Code1281 - any link to this?) seems to be not getting information of printer change. Try to do this:

Printer.BeginDoc;
Printer.Canvas.TextOut(0,128,leftstr(VarToStr(DBGrid3.DataSource.DataSet.FieldByName('NAME').Value),25));
Printer.Canvas.TextOut(0,155,'www.microstore.hu/'+DBtext4.Caption);

Barcode1D_Code1281 := <create component here>
try
  Barcode1D_Code1281.Barcode :=   VarToStr(DBGrid3.DataSource.DataSet.FieldByName('VONALKOD_SN').Value);
  Barcode1D_Code1281.Print(2,-3,1,30,17,0);
finally
  <destroy component Barcode1D_Code1281 here>
end;

Printer.EndDoc; 

Open in new window

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:RT_
ID: 39677604
not working, i think the problem is with the printer component, i have writed out the page parameters to the screen and see that the dimensions not changing.

showmessage(vartostr(printer.PageHeight));
showmessage(vartostr(printer.Pagewidth));

when i'll start the program with default set to tpl2844, they are working, but when i set the default printer to the 2020 or another A4 printer, the settings going to a4 size, but when i am setting the printerindex back to tlp2844, the width and height are not changing back.

starting :
200,320
changing the def printer to the a4:
2374,831
after set the printer. printerindex back to tlp2844
Printer.PrinterIndex := g_barcode_prn_idx;
remains to 2374,831

so that is the problem
0
 
LVL 26

Accepted Solution

by:
Sinisa Vuk earned 50 total points
ID: 39677948
Try set printer index using this function:
http://delphi.cjcsoft.net/viewthread.php?tid=49172
...printing parameters are not set ....
0
 

Author Comment

by:RT_
ID: 39680136
now i am trying to modify the printers.pas, maked a local copy to the project dir, but doesn't work , giving some erros :

http://www.rekettyei.hu/files/printerpas/printer.png
0
 
LVL 26

Assisted Solution

by:Sinisa Vuk
Sinisa Vuk earned 50 total points
ID: 39680191
If you want to modified Printers.pas, please copy .pas into project folder first - then do modify. This issue is described here (so you can use this tips):
http://qc.embarcadero.com/wc/qcmain.aspx?d=33676
0
 

Author Closing Comment

by:RT_
ID: 39688263
Thank you, those 2 was ok
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Service to Receive TCP Packets 4 149
Basic Java Case or If-Else statement... 3 51
Apps blocked by Java 9 81
Math Equation 23 88
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question