How to get default printer margins using win32 in python

I am making software for printing results etc. using python win32. Since all printers use the default marker, it varies from printer to printer, I need the top and left margins of the printer so that I can control my printing accordingly.

I searched and found the following:

PHYSICALOFFSETX = 112
PHYSICALOFFSETY = 113

printer_margins = dc.GetDeviceCaps (PHYSICALOFFSETX/PHYSICALOFFSETY), dc.GetDeviceCaps (PHYSICALOFFSETY)

which gives (0, 0), but when I print the page, there is a field on my Cannon printer that is set by defualt. What does the above code really mean and why are these constants used?

I need a piece of code where I can have a default margin in inches and / or tweets.

+4
source share

Source: https://habr.com/ru/post/1523289/


All Articles