Re: PDF printing under windows.
| From: | Dan Baker | Date: | Mon, 24 Oct 2005 20:39:28 +0000 |
| Subject: | Re: PDF printing under windows. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224587@lists.php.net to get a copy of this message | ||
"Dave Lists" <dave.lists@gmail.com> wrote in message
news:435D2C8C.4090709@gmail.com...
> I'm generating PDFs under windows using PDFlib and all is easy. What I am
> wondering though, and google reveals nothing usefull, can I print the PDF
> to a network printer from windows? I'm presuming to print the file I would
> ahve to use COM and open it under Acrobat? Anyone done this before and
> have any pointers? I'm printing out invoices and what to automate the
> task.
I print PDF files using the following code (which prints them to the default
printer):
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
sei.lpVerb = _T("print");
sei.lpFile = pFile; // -> complete path to file to print
sei.hwnd = CDLBUtils::g_Data.m_hWnd;
sei.nShow = SW_HIDE;
if (ShellExecuteEx(&sei) && sei.hInstApp > (HINSTANCE)32) {
// ok
} else {
// failed
}
Note1: You can change the default printer before calling this.
Note2: Acrobat will launch, and may stay running even after the printing
process has finished
DanB