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

Printing *.pdf files

2 views
Skip to first unread message

Didi

unread,
Dec 9, 1999, 3:00:00 AM12/9/99
to
Hi !

How can I print a acrobat file (*.pdf) from delphi to a specific printer
(not always default printer) without changing the default printer.

My app is a QManager that does all the printing for our applications.

I'm using D4.


Thanks

Didi : Rud...@limon.co.za

Peter Below (TeamB)

unread,
Dec 10, 1999, 3:00:00 AM12/10/99
to
> How can I print a acrobat file (*.pdf) from delphi to a specific printer
> (not always default printer) without changing the default printer.
>
> My app is a QManager that does all the printing for our applications.
>
Acrobat Reader supports the "printto" action on PDF documents. The
Win32.hlp has this to say about printto:

<quote>
HKEY_CLASSES_ROOT
wrifile = Write Document
shell
open
command = C:\Progra~1\Access~1\WORDPAD.EXE %1
print
command = C:\Progra~1\Access~1\WORDPAD.EXE /p "%1"
printto
command =
C:\Progra~1\Access~1\WORDPAD.EXE /pt "%1" "%2" "%3" "%4"

In the preceding commands, the %1 parameter is the filename, %2 is the
printer name, %3 is the driver name, and %4 is the port name. In Windows
95, you can ignore the %3 and %4 parameters (the printer name is unique in
Windows 95).
</quote>

So you need to pass some parameters in addition to the document name to
ShellExecute for the printto action.

var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
S: String;
hDeviceMode: THandle;
begin
Printer.PrinterIndex := -1; // select a printer
Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
S:= Format('"%s" "%s" "%s"',[Device, Driver, Port]);
ShellExecute( handle, 'printto', PChar(documentname), Pchar(S), Nil,
SW_HIDE );

Peter Below (TeamB) 10011...@compuserve.com)
No replies in private e-mail, please, unless explicitly requested!


Didi

unread,
Dec 13, 1999, 3:00:00 AM12/13/99
to
Thanks Peter !

It's exactly what I need.

Regards

Didi : Rud...@limon.co.za

0 new messages