pywintypes.error:(31,31,' Shellexecute',''当使用IP/URL用于路径时,已连接到系统上的设备无法正常工作。')
嗨,所以我有一个代码,它应该在其中打印出PDF文档的硬拷贝。 问题是,当我使用IP/URL设置路径时,我会说错了。
def printInvoice(inv_id):
_filepath = "http://192.168.0.72:8000/AR/invoice/"+inv_id+".pdf"
print(_filepath)
printTheFile(_filepath)
def printTheFile(_file):
currentprinter = win32print.GetDefaultPrinter()
win32api.ShellExecute(0, 'print', _file, None, ".", 0)
time.sleep(1)
os.system("TASKKILL /F /IM Acrobat.exe")
inv_id = "INV2204-001"
printInvoice(inv_id)
如果我设置了直接从脚本文件夹中打印出来的路径,例如“ ar \\发票”
它可以正常工作
,我可以通过使用python -m http.server提供该文件夹。
,它也可以在浏览器上访问。
目的是使其能够在多个设备上使用,并通过一种存储文档的设备在Internet上打印PDF。
Hi so i have a code where it supposed to print out hardcopy of a pdf documents.
Issue is i got said error when trying to print it when i set the path using ip/url.
def printInvoice(inv_id):
_filepath = "http://192.168.0.72:8000/AR/invoice/"+inv_id+".pdf"
print(_filepath)
printTheFile(_filepath)
def printTheFile(_file):
currentprinter = win32print.GetDefaultPrinter()
win32api.ShellExecute(0, 'print', _file, None, ".", 0)
time.sleep(1)
os.system("TASKKILL /F /IM Acrobat.exe")
inv_id = "INV2204-001"
printInvoice(inv_id)
If i set the path to just print it out directly from the script folder like "AR\\invoice"
it works fine
Anyway, i make the folder available by using python -m http.server
which makes it also available to be access on browser.
The goal is to make it able to work on multiple devices and print the pdf over the internet from one device that stores the docs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论