Hi all! I'm a happy chappy - I have the solution. If you want to know how to print a specific file to a specific printer, here's one method that works:
ShellExecute(Handle, 'print', PChar('c:\RepAdvice.pdf'), PChar('\\NZAKL14SV001\DO_NOT_USE'), nil, SW_HIDE); Note that the 4th parameter is the printer & it's location on the server NZAKL14SV001. Note that I used SW_HIDE rather than SW_SHOW, as I wanted this to be invisible to the user. Thanks to those who gave suggestions. Much appreciated. Dave -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 17 September 2002 15:40 To: Multiple recipients of list delphi Subject: RE: [DUG]: How do you print a file sitting in a directory? Hi, Thanks for the suggestions. They led me to this website http://www.festra.com/eng/sources.htm - which had nearly all I need. My problem now is how to get it printing to the correct printer. Here's a code snippet: SetDefaultPrinter('DO_NOT_USE'); ShellExecute(Handle, 'print', PChar('c:\RepAdvice.pdf'), nil, nil, SW_HIDE); This prints, but not to the DO_NOT_USE printer. In shelling out it must lose this setting. The 1st "nil" above can be replaced with the a "string that specifies executable-file parameters". How would I specify the network printer here? I tried: ShellExecute(Handle, 'print', PChar('c:\RepAdvice.pdf'), PChar('\\DO_NOT_USE'), nil, SW_HIDE); but it didn't work. I had a look on Adobe's site for command line syntax but no immediate joy. Any ideas? Thanks. Dave -----Original Message----- From: Robert Martin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 17 September 2002 14:55 To: Multiple recipients of list delphi Subject: Re: [DUG]: How do you print a file sitting in a directory? You could use shell execute or the like to send a command line command to do it, something like 'Copy c:\sdf\sdf\myPDF.pdf prn'. I think this would send it to the default local printer, for other printers you might be able to use the network printer i.e //FREDDYS_COMPUTER/HP_LASERJET. This is all off the top of my head (and there may be better ways) but I think this is a quick (and not to dirty) way of printing a doc to a printer. Rob Software engineer Wild Software Ltd Ph 03 338-1407 ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Tuesday, September 17, 2002 2:46 PM Subject: [DUG]: How do you print a file sitting in a directory? > Hi, > > I want to tell Windows to print a file residing in X directory. I already > have the correct printer assigned. The file is a PDF. Do I need to read it > into a Delphi component in order to print it, or can I just call some > Windows command? > > I'm sure this is easy, I've just never done it before and can't find the > answer so far on the Net or on the Delphi help. > > TIA > > Dave > > ============================================ > INTERNET E-MAIL CONFIDENTIALITY CLAUSE > > The information contained in this mail message is confidential and may also > be legally privileged. If you are not the intended recipient, please note > that any use, dissemination, further distribution, or reproduction of this > message in any form what so ever, is strictly prohibited. If the mail is in > error, please notify me by return E-mail, delete your copy of the message, > and accept my apologies for any inconvenience caused. > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/