Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Redirect Printeroutput to file with Delphi 5

0 views
Skip to first unread message

André Gauthier

unread,
Jul 4, 2001, 9:02:43 AM7/4/01
to

Hello
I would like to redirect a printing output to a file, but without having the user to give a file-name. (i will do it
in my programm)
How can i use QReport to print to a file, but in a way that i can later use the "print [filename]" command to get the document printed on paper.
I'm working with Windows 2000 and Delphi 5
Thanks and bibi
André

Mike Shkolnik

unread,
Jul 4, 2001, 10:14:05 AM7/4/01
to
Andre,

you can realize one from the next two methods:
1. generate a report and save it into file (QRPrinter.Save method). Also you
must develop a small console application which allow to load a saved report
(QRPrinter.Load method) and print it

2. to develop a visrtual printer driver and hook all printed data into file.
Check the http://www.mabuse.de/noframe/vprinter.html

--
With best regards, Mike Shkolnik
E-Mail: mshk...@scalabium.com
mshk...@yahoo.com
WEB: http://www.scalabium.com

AndrИ Gauthier <an...@gauthier.ch> пишет в сообщении:3b4313f3$1_1@dnews...

> AndrИ


Danny Smalle

unread,
Jul 4, 2001, 6:07:03 PM7/4/01
to
On 4 Jul 2001 06:02:43 -0700, "André Gauthier" <an...@gauthier.ch>
wrote:

>I would like to redirect a printing output to a file, but without having the user to give a file-name. (i will do it
>in my programm)

If you want to redirect straight from delphi (not from QReport); I got
the following code from Peter Below (TeamB). I use it to print via a
postscript printer driver to file, for later printing by an external
company.

Danny.

=========================================

//Procedure courtesy of Peter Below (TeamB)
procedure StartPrintToFile(filename: string);
var
CTitle: array[0..31] of char;
DocInfo: TDocInfo;
begin
with Printer do
begin
BeginDoc;
{ Abort job just started on API level. }
EndPage( Canvas.handle );
Windows.AbortDoc( Canvas.handle );

{ Restart it with a print file as destination. }
StrPLCopy(CTitle, Title, SizeOf(CTitle) - 1);
FillChar(DocInfo, SizeOf(DocInfo), 0);
with DocInfo do
begin
cbSize := SizeOf(DocInfo);
lpszDocName := CTitle;
lpszOutput := PChar(filename);
end;
StartDoc(Canvas.handle, DocInfo);
StartPage(Canvas.handle);
end;
end;

0 new messages