Recent

Author Topic: Problems with printer4Lazarus in Ubuntu  (Read 450 times)

odvesims

  • Full Member
  • ***
  • Posts: 176
Problems with printer4Lazarus in Ubuntu
« on: May 14, 2019, 09:31:53 pm »
Hey There!

I'm using the Printer4Lazarus package to manage printing on my app. It works fine on Windows, but it doesn't work in ubuntu. This is what I'm doing:

Code: Pascal  [Select]
  1. myPrinter:= Printer.Create;
  2. myPrinter.title = 'someTitle';
  3. myPrinter.RawMode:= True;
  4. myPrinter.BeginDoc;
  5. myPrinter.write(printing[1], Length(printing), printInt);
  6. myPrinter.EndDoc;

My current printer is a Star TPS700 (USB). It's connected and installed in my computer. However when I try printing it throws a 'Star_TPS700' (my printer name) is not a valid printer.

What could be causing?

jamie

  • Hero Member
  • *****
  • Posts: 1785
Re: Problems with printer4Lazarus in Ubuntu
« Reply #1 on: May 14, 2019, 11:00:50 pm »
The printer name may not show as you specified it...

You need to examine the "Printers" property and set the "PrinterIndex" property..

List the "Printers" property to a Memo box so you can see what you have or what is being detected.

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Problems with printer4Lazarus in Ubuntu
« Reply #2 on: May 15, 2019, 03:35:41 pm »
The printer name may not show as you specified it...

You need to examine the "Printers" property and set the "PrinterIndex" property..

List the "Printers" property to a Memo box so you can see what you have or what is being detected.

Hey jamie. I did as you suggested, and I can confirm the printer name is the same as I stated above. Also, I tried setting the printerIndex, and still got the same error.

jshah

  • Full Member
  • ***
  • Posts: 178
Re: Problems with printer4Lazarus in Ubuntu
« Reply #3 on: May 15, 2019, 04:57:56 pm »
You dont have create a Printer class.

Just Assign printer name to it Printer.SetPrinter(printer_name);

jesusr

  • Sr. Member
  • ****
  • Posts: 470
Re: Problems with printer4Lazarus in Ubuntu
« Reply #4 on: May 15, 2019, 05:11:41 pm »
Code: Pascal  [Select]
  1. //myPrinter:= Printer.Create;
  2. //myPrinter.title = 'someTitle';
  3. //myPrinter.RawMode:= True;
  4. //myPrinter.BeginDoc;
  5. //myPrinter.write(printing[1], Length(printing), printInt);
  6. //myPrinter.EndDoc;
  7.  
  8. WriteLn(printer.printers.text);
  9. // or ShowMessage(Printer.Printers.Text);
  10.  

What is the output of that?
« Last Edit: May 15, 2019, 05:13:26 pm by jesusr »

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Problems with printer4Lazarus in Ubuntu
« Reply #5 on: May 15, 2019, 05:50:48 pm »
Code: Pascal  [Select]
  1. //myPrinter:= Printer.Create;
  2. //myPrinter.title = 'someTitle';
  3. //myPrinter.RawMode:= True;
  4. //myPrinter.BeginDoc;
  5. //myPrinter.write(printing[1], Length(printing), printInt);
  6. //myPrinter.EndDoc;
  7.  
  8. WriteLn(printer.printers.text);
  9. // or ShowMessage(Printer.Printers.Text);
  10.  

What is the output of that?

It shows the name of both printers I have connected:

STAR_TSP700_
EPSON_TM-P2.01

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Problems with printer4Lazarus in Ubuntu
« Reply #6 on: May 15, 2019, 05:52:33 pm »
You dont have create a Printer class.

Just Assign printer name to it Printer.SetPrinter(printer_name);

Okay, this made some progress. However, the printer is not fully properly working. Sometimes it prints ok, sometimes it shows random characters/changes font format. I changed the cable to make sure it's not something with the cable. Still the same.

jshah

  • Full Member
  • ***
  • Posts: 178
Re: Problems with printer4Lazarus in Ubuntu
« Reply #7 on: May 15, 2019, 06:15:57 pm »
You are using RawMode that means you have to send text/command as per Printer.