[python-win32] Windows printing with the use of Device Context

Tim Roberts timr at probo.com
Tue Nov 8 02:04:07 EST 2022


On 11/7/22 5:25 PM, Neil Kenig wrote:

> You may want to try https://pypi.org/project/PyMuPDF/.   It's relatively easy to create a blank PDF and then insert text of a given font and size at precise locations on the page.  PDF files use points (1/72nd of an inch) for both font sizes and location on a page and will print properly regardless of the printer's resolution (assuming the stock size is the same, e.g. US Letter or A4).  You can then print the PDF and if the preprinted stock is loaded into the printer, you should get the desired result.

This is excellent advice, and it has the huge advantage of being 
cross-platform.  The Windows printing API is, in my expert opinion, 
peculiar and finicky.

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



More information about the python-win32 mailing list