GrabzIt's screenshot API is very flexible and can be called from any type of Ruby application. The best way to put website screenshots or HTML to image functionality and more into your Ruby app is by following these steps:
First create an instance of the Client class, passing your application key and application secret from your GrabzIt account to the constructor to start using GrabzIt's API .
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
Then use one of the image, PDF, animation or table methods to capture a URL or convert HTML.
# To take a image screenshot
# Or to take a PDF screenshot
# Or to convert online videos into animated GIF's
# Or to capture table(s)
# To convert HTML into a image
# Or convert HTML into a PDF document
# Or convert HTML into a CSV, XLSX or JSON document
# To convert HTML file into a image
# Or convert HTML file into a PDF document
# Or convert HTML file into a CSV, XLSX or JSON document
Finally use one of the following save methods to complete the capture. The Save method requires the URL of a handler, which will process the callback from GrabzIt to save the resulting screenshot.
Another option is to use the synchonous save_to method, which will force your application to wait while the screenshot is created so it should only be used were the save method cannot be used. Once the screenshot is created it is saved to the file path provided.
filepath = "images/result.jpg"
There are many special features that can be used when taking screenshots of webpages or converting HTML. Including; configuring the browser height, browser width, screenshot height, screenshot width, the delay before a screenshot is taken and the image format of the screenshot. For all these options and more please read the Client documentation.