"Dave Lists" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to