如何使用 Python 在浏览器中预览 pdf 文件?
How to preview pdf file in browser using Python?
我想在浏览器中预览 pdf 文件,然后重命名该文件,然后将其邮寄给某人。是否可以使用 python 脚本来做到这一点?
有使用浏览器的模块
import webbrowser
new = 2 # open in a new tab, if possible
# open a public URL, in this case, the webbrowser docs
url = "http://docs.python.org/library/webbrowser.html"
webbrowser.open(url,new=new)
# open an HTML file on my own (Windows) computer
url = "file://X:/MiscDev/language_links.html"
webbrowser.open(url,new=new)
示例来源 here; documentation here。
它应该以与 Pdf 文件相同的方式工作,而不是 html,如果浏览器可以打开它们的话。
如果您想在预览时暂停,可以使用
wait = input("PRESS ENTER TO CONTINUE.")
重命名有答案here, you use os.rename(src, dst)。
已回复电子邮件 here, documentation here。
现在把它们放在一起!
我想在浏览器中预览 pdf 文件,然后重命名该文件,然后将其邮寄给某人。是否可以使用 python 脚本来做到这一点?
有使用浏览器的模块
import webbrowser
new = 2 # open in a new tab, if possible
# open a public URL, in this case, the webbrowser docs
url = "http://docs.python.org/library/webbrowser.html"
webbrowser.open(url,new=new)
# open an HTML file on my own (Windows) computer
url = "file://X:/MiscDev/language_links.html"
webbrowser.open(url,new=new)
示例来源 here; documentation here。 它应该以与 Pdf 文件相同的方式工作,而不是 html,如果浏览器可以打开它们的话。
如果您想在预览时暂停,可以使用
wait = input("PRESS ENTER TO CONTINUE.")
重命名有答案here, you use os.rename(src, dst)。
已回复电子邮件 here, documentation here。
现在把它们放在一起!