Re: Windows printing with the use of Device Context

Tim Roberts <[email protected]> Mon, 7 Nov 2022 15:49:35 -0800
Newsgroups gmane.comp.python.windows
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
Antoine FINET wrote:
>
> I would like to print information at the correct coordinates on a pre 
> printed form.
>
> If I understood correctly my readings, the coordinates given to a 
> "TextOut" Printer Device Context depend on the resolution of the 
> printer. Am I right?

Yes, but the exact same thing is true of on-screen windows.  You can use 
GetDeviceCaps(hdc, LOGPIXELSX) to get the pixels per inch resolution.  
There's also a LOGPIXELSY, but unless you have a 40-year-old graphics 
adapter, they are the same.  The DeviceCapabilities API returns a 
DEVMODE structure that has detailed information about the printer.


> I don't have another printer to test but my underlying question is : 
> does the coordinates depend on the printer?

Absolutely, yes.  Modern printers can be 300, 600, or 1200 dots per 
inch.  Label printers can use even wilder values.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32
smime.p7s (application/pkcs7-signature, 3.3 KB) - not displayed