New Web Screen Capture Methods.

the DocumentAlchemy blog

 

It's been a busy week for the Document Alchemists.

As previously mentioned, after much experimentation with web rendering engines, we've created a heuristic-driven solution that chooses among many options (and occasionally some minor pre- and post-processing of the input HTML and output image).

This week we released new REST endpoints for creating a screenshot (or multiple screenshots) of a web page or HTML document based on that hybrid solution.

To render a web page as an image, invoke the GET /api/v1/document/-/{FORMAT} end-point, passing the URL of the page to be captured and the desired image format.

For example, here's a simple curl command to capture a screenshot of Google's current homepage:

curl -H 'Authorization: da.key=7CEemRWyWqyblRXk' \
     'https://documentalchemy.com/api/v1/document/-/rendition/png?url=https://google.com/' \
     -o google-screenshot.png

That's all it takes.

You can experiment with the basic functionality online with our free Web Screenshot tool.

To render a web page as several images, invoke the POST /api/v1/document/-/{FORMAT} end-point, passing the URL of the page to be captured and a list of specifications for the screenshots you'd like to capture.

You can experiment with the multi-capture functionality with our Responsive Design Tester demonstration. It's actually a pretty nifty tool. Using that form, you can capture more than 40 screenshots (at different resolutions and aspect ratios) in a single call.

With both API methods, not only can you control the browser viewport, but you can scroll the virtual browser anywhere on the page, submit custom HTTP headers for authentication or personalization, scale the generated image independent of the browser size, aspect ratio and resolution.

(We also have some back-end capabilities we haven't fully exposed through the API yet, so let us know if there is another knob you'd like to able to turn.)

And of course, this is backed by a fully-functional (if virtual) web browser, so it fully renders the CSS, executes the JavaScript and supports media-rich pages.

As before, while our web-to-image service has been through several iterations of internal testing, tuning and improvement, we fully expect we'll encounter new and interesting edge-cases now that the usage is expanding. We invite and encourage you to use the web capture and responsive site testing tools (and to share them with your friends). We think you'll find them useful, and we appreciate any questions, suggestions or feedback you may have for us after using it.

About DocumentAlchemy

DocumentAlchemy is a RESTful web service that developers can use to add document generation, conversion and processing features to their app.

Visit our live demonstrations or interactive API reference to explore Document Alchemy's rapidly growing API for working with MS Office documents, PDFs, images, web pages and more.


Copyright © 2017 DocumentAlchemy.