From: "Peter Below (TeamB)" <100113.1101@compuXXserve.com> Subject: Re: Printing *.pdf files Date: 10 Dec 1999 00:00:00 GMT Message-ID: Content-Transfer-Encoding: 8bit References: <82o6if$6fp10@forums.borland.com> Content-Type: text/plain; charset=iso-8859-1 Organization: TeamB Mime-Version: 1.0 Reply-To: 100113.1101@compuXXserve.com Newsgroups: borland.public.delphi.winapi > 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: 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). 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) 100113.1101@compuserve.com) No replies in private e-mail, please, unless explicitly requested!