问题描述
我正在尝试编写一个烦人的任务,该任务涉及获取、处理和打印扫描文档(jpeg 或 pdf)的负载.我没有成功从 python 或 windows shell 访问打印机(我可以用 python subproccess 模块编写脚本).我成功地使用 lpr 命令从命令行打印了一个文本文件,但不是 jpg 或 pdf.
I'm tryin to script an annoying task that involves fetching, handling and printing loads of scanned docs - jpeg or pdf. I don't succeed in accessing the printer from python or from windows shell (which I could script with python subproccess module). I succeeded in printing a text file from the command line with lpr command, but not jpg or pdf.
很高兴有关于这方面的任何线索,包括更广泛的用于打印到打印机的 win shell 参考,我在谷歌搜索 stackoverflow 搜索中遗漏了一个合适的 python 库等(只有一个 未回答的问题)
be glad for any clues about that, including a more extensive win shell reference for printing to printer, a suitable python library I missed in my google search stackoverflow search etc (just one unanswered question)
推荐答案
好吧,经过一番研究,我找到了一些可能对您有所帮助的链接:
Well, after a little research I found some links that might help you:
1) 要使用 Python Shell 打印图像,下面的这个链接有一些使用 PIL 的代码,希望能够满足您的需求:http://timgolden.me.uk/python/win32_how_do_i/print.html
1) To print images using Python Shell, this link below has some code using PIL that will, hopefully, do what you want:http://timgolden.me.uk/python/win32_how_do_i/print.html
2) 要打印 PDF 文件,此链接可能包含您需要的内容:http://www.darkcoding.net/software/打印word-and-pdf-files-from-python/
2) To print PDF files, this link may have what you need:http://www.darkcoding.net/software/printing-word-and-pdf-files-from-python/
我从来没有做过这些事情,但快速浏览一下,我可以找到这个链接,它们似乎很有意义.希望它有帮助:)
I never did any of those things, but with a quick look, I could find this links and they seem to make very much sense. Hope it helps :)
这篇关于使用 python 或 shell 命令打印到 Windows 打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!