0

I am looking for convert a webpage to a PDF. I searched this like "take screenshot of all webpage". In everywhere, everybody refers python "selenium" module. But didn't find anything about "all page". Don't want to a single screenshot. My whis is like PDF format.

Already tried to imgkit. Is there any option?

sirmaci
  • 93
  • 4
  • 16

2 Answers2

0

It would appear that there is something called pdfkit, also a wkhtmltopdf wrapper for python.

https://github.com/JazzCore/python-pdfkit

Alternatively I would recommend CutyCapt, that is if it does not have to be a python library.

http://cutycapt.sourceforge.net/

Jinksy
  • 421
  • 4
  • 11
  • Actually it does. I'm trying to do this with python because i need this feature in my program. Little bit challenging for me. Thanks anyway. – sirmaci Sep 23 '19 at 11:51
  • i got some ugly errors on that. But i found my answer – sirmaci Sep 23 '19 at 13:19
0

I found the answer. First module's name is "Selenium-Screenshot".It takes screenshots and compare them in 1 image. For more detailed discussion: Taking a whole page screenshot with Selenium Marionette in Python

from Screenshot import Screenshot_Clipping
from selenium import webdriver

ob=Screenshot_Clipping.Screenshot()

options = webdriver.ChromeOptions()   #created for headless chrome
options.add_argument('headless')
options.add_argument('window-size=1920x1080')    #change resolution of screenshots

driver = webdriver.Chrome(chrome_options=options)
url = "your_url"
driver.get(url)
img_url=ob.full_Screenshot(driver, save_path=r'.', image_name='Myimage.png')
driver.close()
driver.quit()
sirmaci
  • 93
  • 4
  • 16