Re: Delphi 7 / PDF Print

Posted by webmaster Guido on June 08, 2004

In Reply to: Delphi 7 / PDF Print posted by Todd Jaspers - NA on June 07, 2004

: Hey guys, as simply put as possible, I'd like to be able to print a PDF file from Delphi. What will be understood is:

: A) I will already know the file name.
: B) I will already know the printer information.

: Is there a way to print a PDF file from within a Delphi NT Service and pass it the printer information?
: Or how about just printing a PDF from a Delphi NT service anyway... I could probably change the default printer real-time.
-----------------------------

In your Delphi application, use the same ShellExecute code as for printing any other "registered" document type. Registered means: if the extension is known by Windows, it will send it to its native application. Example:

ShellExecute(Handle, 'print', PChar('c:\test\test.pdf'), nil, nil, SW_SHOW)

This will work if there is an application on the system that can print .PDF files, such as Acrobat Reader.

Find related articles

Search for:  shellexecute

Delphi Forum :: Tutorials :: Source code :: Tips