[python-win32] How to obtain printer HANDLE as int in Python

Tim Roberts timr at probo.com
Mon Dec 10 16:49:24 EST 2018


paolo bonatti via python-win32 wrote:
> I'm trying to print PDF documents with pdfix sdk utilizing win32print. 
> This PDF library requires printer HANDLE value as int directly not as 
> a PyObject.
>
> Is there any way to obtain printer HANDLE value in Python code?
> (attached is a sample)

>    hDC.CreatePrinterDC (win32print.GetDefaultPrinter ())

If that is getting you what you need, then

     win32print.OpenPrinter( win32print.GetDefaultPrinter() )

will get you the handle to that printer.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list