how to execute dos print in delphi for matrix printer

marlon_ric
marlon_ric used Ask the Experts™
on
Hi everyone,

I'am a new user on this site and really hoping for your help. I'm presently having a problem in producing a report that will use an Epson (FX1170) Dot Matrix printer.

I tried Crystal report and Quick report but It did not work, the crystal report produce a report preview that looks good in Windows but when I actually send it to printer it is somehow miss aligned, and it is very slow, even when if I used a draft font. I read some FAQ here and learned that the best way is to print a report in text file format using Dos command. My problem now is how to execute dos command from a delphi application. I did tried Shellexecute, it works but it first print the Filename of the text file and skip several lines before it prints the actual content. Also when it prints, it seems that I cannot use the printer's native font and the condensed mode dont work.

I really need to solve this, please help me.
Thank you very much.
Marlon
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
uses
  Printer;

procedure TForm1.Button1Click(Sender: TObject);
var
  MyFile: TextFile;
begin
  AssignPrn(MyFile);
  try
    Rewrite(MyFile);
    WriteLn(MyFile, 'This is a printed text!');
  finally
    CloseFile(MyFile);
  end;
end;

Author

Commented:
Thanks DragonSlayer!

I did tried the codes you gave and it prints on that printer, but still doesn't seem to use the native fonts and control of the fx1170 printer because I cannot condense its font's size. Whereas if I put it on a file and on the Command Prompt use "copy myfile.txt prn", I can condense the fonts, just like what a DOS application can do.

best regards
marlon
so you can't send control codes?
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Author

Commented:
yes, I think thats what i need.
marlon_ric:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial