Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-02

no driver and com printing

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

fikri zainul

Hi all,
I have a printer (Epson TM U220D, plugged in COM1 port) and my OS Linux/Fedora10 I can't found the driver printer for this OS (only for SUSE and Ubuntu that Epson provided). (Using Generic/TextOnly driver, not working)

So, I can't do printing process for my lazarus application.

My first question is,

[?] Do you know how to handle this situation? (Driver problem)

Temporary, I try to print via command line (Terminal/Dos command like) to the printer using command line 'cat textfile.log > /dev/ttyS0',

and it's worked. Something printed.

And the (second) question is,

[?] How to apply this command (multiple lines sometimes) in Lazarus Code?

(By pressing from a button maybe) Can you all give me some codes to execute?

Thank you for reading my question(s)? :) !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120210/53b416bc/attachment.html>

Reply by email

zeljko
to fikri zainul
fikri zainul wrote 11 lines
Hi all, I have a printer (Epson TM U220D, plugged in COM1 port) and my OS Linux/Fedora10 I can't found the driver printer for this OS (only for SUSE and Ubuntu that Epson provided). (Using Generic/TextOnly driver, not working) So, I can't do printing process for my lazarus application. My first question is, [?] Do you know how to handle this situation? (Driver problem)

Yes, set it in cups properly, but DO NOT use Generic Text, use Raw printing driver and set proper ESC/POS.
This is how I do that:
1.Prepare TStringList with commands and data to be printed. eg:

  MyPosList := TStringList.Create;
  MyPosList.Add(SEQUENCE_FOR_PRINTER_INITIALIZATION(read escposmanuals))
  MyPosList.Add('Hello world line 1');
  MyPosList.Add('Hello world line 2');
  MyPosList.Add('Hello world line 3');
  MyPosList.Add(SEQUENCE_FOR_CUTTER (if there's cutter));
  MyPosList.SaveToFile(YourTempFileOrWhatever);
  MyFunctionForPosPrinting(YourTempFileOrWhatever) (look below)

2.Save it to temp file eg. /tmp/myposprinter_XXXXX.txt 3.call cups to print it to desired pos printer (via Libc.System()/TProcess/ExecuteProcess) -> lpr -PMYPOSPRINTER /tmp/myposprinter_XXXXX.txt

I'm using ExecuteProcess()
http://www.freepascal.org/docs-html/rtl/sysutils/executeprocess.html

4.Delete temp file.

Show quoted text 6 lines
Temporary, I try to print via command line (Terminal/Dos command like) to the printer using command line 'cat textfile.log > /dev/ttyS0', and it's worked. Something printed.

DO NOT USE IT EVER. It's direct port printing and you can have troubles on user machines with permissions, selinux etc etc.
Cups handles that fine.

Show quoted text 7 lines
And the (second) question is, [?] How to apply this command (multiple lines sometimes) in Lazarus Code? (By pressing from a button maybe) Can you all give me some codes to execute?

1.Use ESC/POS docs (or any other docs for your pos printer, but I guess that TMU220D is pure ESC/POS printer.
2.Do as I explained above.

zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120210/134c00f7/attachment-0001.html>

Reply by email

Zaher Dirkey
to zeljko

2012/2/10 zeljko

1.Use ESC/POS docs (or any other docs for your pos printer, but I guess that TMU220D is pure ESC/POS printer.

And you can get some help about ESC commands from my project http://sourceforge.net/projects/minilib
/comm/printers/escpos

But miniComm not work in Linux yet (not tested).

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120211/a2530189/attachment.html>

Reply by email