0

Here's what I want to do:

  1. Load a web page from a specific location
  2. Print that web page into a jpeg, png, or other graphic file format
  3. Upload that image to another site, or save it to a location on my local network

I know about window.print(), but that always seems to open up a print window, and I'd like to do as much of this operation silently as possible.

Essentially, I want to be able to take a snap shot of the web page so it can be put in a directory that is accessed by one of those electronic picture frames. They can either access a web-based service, or a directory on the local network.

Thanks in advance for your help, Rben

4
  • You can't do it through javascript. You can do this with a server side script using PHP/.Net etc Commented Dec 31, 2010 at 2:41
  • @Cybernate: You'd need an HTML renderer, and you wouldn't get the client's cookies. Commented Dec 31, 2010 at 2:43
  • Why do you want to do this in Javascript? Commented Dec 31, 2010 at 2:43
  • Doesn't have to be javascript. I do need an HtML renderer, but am not sure which is best choice. I originally hoped to just use the browser for that. Commented Dec 31, 2010 at 16:31

3 Answers 3

1

Browsers will not let you print "silently", because if they did websites all over the place would use them to overload your printer with spam. There's no way around it (and if you found one, they'd close it as quickly as they could).

So, you could either a) create a browser plugin or something similar that gets you outside the broswer's "sandbox", OR, b) write a web crawler app that obtains the web page, and find some other technique to render it into an image (drive a browser programmatically perhaps).

If either of those sounds promising, let me know and I can fill in more detail on how to go about them.

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

2 Comments

It doesn't have to be a browser plugin. I was just looking for a shortcut when it came to rendering the page. I'm pretty handy with Java and scripting languages, so a crawler might be better.
Charlie, if you could tell me more about your crawler suggestion, I'd appreciate it. What would you use for rendering the page?
0

You can't do that using javascript. wkhtmltopdf can help you. Here are the list of tools available to do it in this SO discussion.

1 Comment

Once it's a pdf, I still need to convert it into an image file. So this is close, but not quite what I need. Should I be looking at webkit?
0

I put together a script i think might be just what your looking for... Screenshot Demo.

It uses printElement and Feedback.js(Can't remember the source) and it allows you to screenshot the whole webpage and either send it as an email or to a printer.

Let me know if this helps and sorry i have no put more detail about it on the page but I am at work at the moment lol

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.