Skip to content

Instantly share code, notes, and snippets.

@ettorerizza
Created November 16, 2019 14:16
Show Gist options
  • Save ettorerizza/afe473b9b378110b0bd2e178e5b5d375 to your computer and use it in GitHub Desktop.
Save ettorerizza/afe473b9b378110b0bd2e178e5b5d375 to your computer and use it in GitHub Desktop.
to improve
import os
CHROME_PATH = r"/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
url = "https://www.tidytextmining.com/tfidf.html"
def url_to_pdf(url, filename):
chrome_args = [CHROME_PATH,
'--headless',
'--disable-gpu',
f'--print-to-pdf={filename}.pdf',
url, ]
cmd = r" ".join(chrome_args)
os.system(cmd)
url_to_pdf(url, "sds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment