Re: How to create screen capture of website
You could get a screenshot using selenium running in headless mode:
#!/usr/bin/env python
from selenium import webdriver
from pyvirtualdisplay import Display
display = Display(visible=0, size=(1366, 768))
display.start()
browser = webdriver.Firefox()
browser.get('http://www.google.com/')
browser.save_screenshot('screenshot.png')
browser.quit()
display.stop()
And you can scroll to different parts of the page using this:
driver.execute_script("window.scrollTo(x, y);") # specify x and y
I believe this code only works on Linux and you will need xvfb installed.

On Sun, 2013-06-16 at 04:04 -0700, codingdaddy wrote:
Hi,
I am sorry if this is the wrong place to ask this question.
But basically, I would like to create social bookmarking site in Django.
That is why I have this question "How do I create a png image of a website given url".
Would anyone give me a pointer as to how I can do this?
Thanks for your time in advance.
codingdaddy
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home