Solved

Print ASCII Files in Delphi 2

Posted on 1997-05-29
2
285 Views
Last Modified: 2010-04-06
Hello, my name is Angel and I have a problem. I don't know how I can print an ASCII file in Delphi after press a button. I don't want use TPrinter component. I like that result was identical that I wrote in MS-DOS 'print autoexec.bat'.
0
Comment
Question by:Anglaf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

by:StevenB
ID: 1336645
*********   See Comment in other instance of this question   *********

(Can I recomend that you mail Customer Support to get this question removed)
0
 
LVL 4

Accepted Solution

by:
erajoj earned 50 total points
ID: 1336646
This will do for 50 pt:

procedure TMainForm.Button12Click(Sender: TObject);
var
  t, lpt: TextFile;
  line  : string;
begin
  if OpenDialog.Execute then try
    AssignFile(t, OpenDialog.Filename);
    AssignFile(lpt, 'LPT1');
    FileMode := 0;
    Reset(t);
    Rewrite(lpt);
    while not EOF(t) do begin
      ReadLn(t, line);
      WriteLn(lpt, line);
    end;
    Write(lpt, #4); // end of transmission
    CloseFile(lpt);
  except
    // trap errors here
  end;
end;

procedure TMainForm.Button13Click(Sender: TObject);
begin
  Winexec('cmd /c print main.txt', SW_HIDE);
end;

/// John

0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

690 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