I'm not sure if the title conveys the best approach to my problem, so let me step back a little bit.
My company is setting up an advertisement affiliate program. We have a widget that will soon be displayed on numerous Web pages, and this widget will contain an advertisement block that will show various ads from our affiliate retailers.
We need a solution that will allow us to quickly (and using as much automation as possible) create thousands of ads for different products. Unfortunately, our ad management service (Google Ad Manager) only accepts image-based ad creatives (it actually accepts Flash, but we don't want to use that). An ad management service that accepts HTML ads might also be a viable solution, if anyone has any suggestions.
Coming from the Web development world, our initial idea was to create a browser-based UI that allows a non-technical person to enter all of the content for an ad (product name, MSRP, sale price, product review, etc.) and its dimensions. Using this information, the application would lay out the ad in a "preview" <div> next to the input form to enable the user to see and update the ad's layout and content. They could then use this HTML preview to adjust the text, product image size, etc., to end up with an acceptable ad layout.
That all seems achievable enough for us. The tricky part is figuring out an efficient and scalable way to turn that HTML preview that we can see in the browser into an image of reasonably high quality. We could take a screenshot of the page when each ad is complete, but that would involve several additional steps - copying the screenshot into an image editor, cropping, saving, and uploading it to our server so that we can point Google Ad Manager to the URL of the image. Multiplying these steps by thousands and thousands of ads, this would make the process more cumbersome than we feel it needs to be.
So, I'm ultimately looking for a method - be it a browser plugin, a bookmarklet, a method for doing this server-side or client-side with Ruby, Java, or JavaScript, etc. - to turn what we see in the browser window into an image that lives on our server in as few steps as is reasonably possible.
However it works, it seems that whatever takes the screenshot will have to either understand the notion of HTML/CSS rendering to know where the extremities of the ad "image" lie (like the dimensions and position of its parent HTML element), or be able to crop out just the ad square against the blank white page background (I'm thinking along the lines of a Photoshop Action using the magic wand tool).
If anyone has any ideas or suggestions to share, I'd very much appreciate it!