I want to add a button to this page that creates a pdf screenshot of the website using the [url removed, login to view] API. [url removed, login to view]~demo/order_form/
Here are the instructions from the website:
[url removed, login to view]
The best way to put website screenshots into your PHP application is by downloading our simple to use PHP package.
The diagnostics panel can help you debug your code!
GrabzIt's screenshot API is very flexible and can be called in many ways such as from a cronjob or a PHP web page.
First of all create an instance of the GrabzItClient class. Pass your application key and application secret from your GrabzIt account to the constructor. [ I will provide that]
include("[url removed, login to view]");
// Create the GrabzItClient class
// Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
$grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");
Then use one of the SetImageOptions, SetPDFOptions, SetAnimationOptions or SetTableOptions methods to request that the GrabzIt service take a screenshot of the URL passed to it.
// To take a image screenshot
$grabzIt->SetImageOptions("[url removed, login to view]");
// Or to take a PDF screenshot
$grabzIt->SetPDFOptions("[url removed, login to view]");
// Or to convert online videos into animated GIF's
$grabzIt->SetAnimationOptions("[url removed, login to view]");
// Or to capture table(s)
$grabzIt->SetTableOptions("[url removed, login to view]");
Then use one of the following save methods. Notice that we also include the URL to the [url removed, login to view] this handler will process the callback from the service and save the resulting screenshot.
$grabzIt->Save("[url removed, login to view]");
Alternatively the synchonous SaveTo method, this 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/[url removed, login to view]";
There are many more options 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 please see the Client documentation.
Capture PDF Screenshots with PHP API
When taking PDF screenshots of websites GrabzIt's PHP API provides the following features that help integrate GrabzIt into your system as easily as possible. However before you start remember that after calling the SetPDFOptions method the Save or SaveTo method must be called to take the PDF screenshot.
PDF screenshots captures the entire web page and turns it into a PDF document of potentially many pages. The only parameter that is required in order to take a screenshot of a web page is the URL.
You can pass through a custom identifier into the SetPDFOptions method as shown below, this value is then returned to your GrabzIt PHP handler. For instance this custom identifier could be a database identifier, allowing a screenshot to be associated with a particular database record.