'Python I want to print the text from printer but I want to be in the middle of the paper

as can be understood from the title, I want to print a .txt file from the printer so that it is in the middle of the page. I know this is possible with the win32printer library but when I read the documentation I couldn't find an exact setting for it, which margin values ​​will help me to center the text exactly? Or is there a preset setting for my averaging?


from win32printing import Printer

with Printer(linegap=1) as printer:
    printer.text("title1", font_config=font)

I tried to do with margin settings but cant find a exact solution



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source