Pregunta

I have searched everywhere for this and could not find an answer. I am using os.system to print to a printer, but it prints it off as a portrait and I need it to print off as Landscape. I assume there is a simple way to add something within the os.system command to get this to work, but I cannot figure out what it is. This is how I am printing it off right now:

os.system('lp "file.png"')
¿Fue útil?

Solución

Try os.system('lp -o landscape "file.png"')

Otros consejos

Ok it was a bug, but just a hint on convenience:

I usually replace os.system with the following snippet

from subprocess import (PIPE, Popen)


def invoke(command):
    '''
    Invoke process and return its output.
    '''
    return Popen(command, stdout=PIPE, shell=True).stdout.read()

or if you want to be more comfortable with sh, try

from sh import lp

lp('-o', 'landscape', 'file.png')
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top