import os
import win32print
import win32api
'''
发送文件到打印机打印
'''
def printer_loading(filename):
win32api.ShellExecute(0,
"print",
filename,
'/d:"%s"' % win32print.GetDefaultPrinter(),
".",
0
)
if __name__=='__main__':
print("print file")
full='e1.pdf'
#full='d:/e1.pdf'
printer_loading(full)
#循环发送单个文件给打印机队列
path='D:/文件夹'
for filenames in os.listdir(path):
printer_loading(os.path.join(path,filenames))