Delphi 5 - How to Send a FORM FEED Command

I am using Delphi 5 (still) and just finishing off an application.
It would be REALLY useful if I could click on a button to send a Form Feed to the default printer.

Can someone tell me what the correct lines to insert are?
The rest of the reports are, suprisingly, generated by QReports :-).

With thanks,

Ed
LVL 1
edhastedAsked:
Who is Participating?
 
quilleyCommented:
uses Printers;

procedure TForm1.btnFormFeedClick(Sender: TObject);
begin
  Printer.BeginDoc;
  Printer.EndDoc;
end;

Quick & dirty, but it works!
0
 
bernaniCommented:
0
 
bernaniCommented:
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
edhastedAuthor Commented:
With the formfeed.dpr function I was uncertain how to imbed it into my program and then call it - exuse my naievity.

With the Torry example what happens if it's not LPT1? Is it possible to get it to send to the defualt printer?

Ed
0
 
edhastedAuthor Commented:
Where does Printer. come from?

Delphi generates unidentfied Identifer when I try this.

There doesn't appear to be a Printer. drop in or am I missing something fundametnal.

Yours,

Ed
0
 
edhastedAuthor Commented:
Sorted, put the Printers unit and and prefixed the syntax so it reads:

begin
  Printers.Printer.BeginDoc;
  Printers.Printer.EndDoc;
end;

This is universally simple - sends to the defaul printer and wonderfully short.

This is the quickest and most efficient of the solution provided.

With many thanks,

Ed Hasted
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.