Print Vertical Text with win32printing Python

Viewed 30

I'm writing a Python Code to print something in a Thermal Printer and I would like it with a vertical orientation with a width of 80mm. I have found, so far that the easiest way to do it is with "win32printing". The good thing is that I don't need to create a template.

Actual Output:

enter image description here

Desired Output:

enter image description here

is it possible?

I have the following code:

def Print_Card(Kunde,Place1,IdCard,Address1,Wagen):

    from win32printing import Printer

    title1 = {
        "height": 45,
        "weight":"700",
        "faceName":'Consolas',
    }
    title2 = {
        "height": 35,
        "faceName":'Consolas',
    }
    content = {
        "height": 25,
        "faceName":'Consolas',
        "italic":True,
    }

    with Printer(linegap=2,printer_name='Microsoft Print to PDF',margin=(21.1,22.2,10,0), auto_page=False) as printer:
        printer.text(Place1, font_config=title1,align='left')
        printer.text(Address1, font_config=title2,align='left')
        printer.text(IdCard, font_config=title2,align='left')        
        printer.text(Kunde, font_config=content,align='left')
        printer.text("--------------------------------------------", font_config=content,align='left')
        printer.text(Wagen, font_config=content,align='left')  
        printer.new_page()


if __name__ == '__main__':
    Kunde='Client Name'
    Place1='Branch 1'
    IdCard='76913155'
    Address1='Address #123465'
    Wagen='1520159,152198'

    Print_Card(Kunde,Place1,IdCard,Address1,Wagen)

I hope it is possible, if you have another package to work with, it would be spectacular. Thank you very much in advance!

0 Answers
Related