import pdfkit #Define path to wkhtmltopdf.exe path_to_wkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe' #Define path to HTML file path_to_file = 'sample.html' #Point pdfkit configuration to wkhtmltopdf.exe config = pdfkit.configuration(wkhtmltopdf=path_to_wkhtmltopdf) #Convert HTML file to PDF pdfkit.from_file(path_to_file, output_path='sample.pdf', configuration=config)
--
--
------------------------------------
Grupo Python-Brasil
https://wiki.python.org.br/AntesDePerguntar
<*> Para visitar o site do grupo na web, acesse:
http://groups.google.com/group/python-brasil
<*> Para sair deste grupo, envie um e-mail para:
python-brasi...@googlegroups.com
---
Você recebeu essa mensagem porque está inscrito no grupo "Python Brasil" dos Grupos do Google.
Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para python-brasi...@googlegroups.com.
Para ver essa discussão na Web, acesse https://groups.google.com/d/msgid/python-brasil/6cf144c4-c423-42df-8495-2ade914b52a5n%40googlegroups.com.
Segue o modelo do projeto.from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
import time
import pdfkit
servico = Service(ChromeDriverManager().install())
navegador = webdriver.Chrome(service=servico)
navegador.get('https://www.tabelafipebrasil.com/carros')
time.sleep(5)
path_to_wkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
path_to_file = 'sample.html'
config = pdfkit.configuration(wkhtmltopdf=path_to_wkhtmltopdf)
pdfkit.from_file(path_to_file, output_path='sample.pdf', configuration=config)
Para ver essa discussão na Web, acesse https://groups.google.com/d/msgid/python-brasil/eec2e3ce-b8b8-4d18-8980-6545bb3626e9n%40googlegroups.com.