-1

I want to preview a pdf file in browser then rename that file and then mail it to someone. Is it possible to do this with python script?

1

1 Answer 1

1

There is a module to use the browser

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)

Source of the example here; documentation here. It should work the same way with Pdf files instead than html, if the browser can open them.

If you want to pause while you preview it, you can use

wait = input("PRESS ENTER TO CONTINUE.")

Renaming has an answer here, you use os.rename(src, dst).

Emailing has been answered here, documentation here.

Now put it all together!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.