Description
This class handles all communication with the GrabzIt screenshot web services.
Public Methods
- GrabzItFile GetResult(String id)
- URLToAnimation(String url, AnimationOptions options)
- URLToImage(String url, ImageOptions options)
- HTMLToImage(String html, ImageOptions options)
- FileToImage(String path, ImageOptions options)
- URLToPDF(String url, PDFOptions options)
- HTMLToPDF(String html, PDFOptions options)
- FileToPDF(String path, PDFOptions options)
- URLToDOCX(String url, DOCXOptions options)
- HTMLToDOCX(String html, DOCXOptions options)
- FileToDOCX(String path, DOCXOptions options)
- URLToTable(String url, TableOptions options)
- HTMLToTable(String html, TableOptions options)
- FileToTable(String path, TableOptions options)
- URLToRenderedHTML(String url, HTMLOptions options)
- HTMLToRenderedHTML(String html, HTMLOptions options)
- FileToRenderedHTML(String path, HTMLOptions options)
- URLToVideo(String url, VideoOptions options)
- HTMLToVideo(String html, VideoOptions options)
- FileToVideo(String path, VideoOptions options)
- String Save()
- String Save(String callBackURL)
- GrabzItFile SaveTo()
- boolean SaveTo(String saveToFile)
- Status GetStatus(String id)
- GrabzItCookie[] GetCookies(String domain)
- boolean SetCookie(String name, String domain, String value, String path, boolean httponly, Date? expires)
- boolean DeleteCookie(String name, String domain)
- WaterMark[] GetWaterMarks()
- WaterMark GetWaterMark(String identifier)
- boolean AddWaterMark(String identifier, String path, HorizontalPosition xpos, VerticalPosition ypos)
- boolean DeleteWaterMark(String identifier)
- SetLocalProxy(String proxyUrl)
- UseSSL(boolean value)
- String CreateEncryptionKey()
- Decrypt(String path, String key)
- GrabzItFile Decrypt(GrabzItFile file, String key)
- byte[] Decrypt(byte[] data, String key)
This method returns the screenshot itself. If nothing is returned then something has gone wrong or the screenshot is not ready yet.
Parameters
-
id - the unique identifier of the screenshot
Return Value
GrabzItFile object
URLToAnimation(String url, AnimationOptions options)
Specifiy the URL of the online video that should be converted into a animated GIF.
Parameters
-
url - the URL of the online video to convert into an animated GIF.
- Required
-
Accepts Vimeo and YouTube video URL's
- Warning animating Vimeo and YouTube videos depends on a third party and so may not provide consistent results.
- options - a instance of the AnimationOptions class that defines any special options to use when creating the animated GIF.
Return Value
void
AnimationOptions
The class represents all of the options available when creating an animated GIF.
Public Properties
-
setCustomId(String value) - custom identifier that you can pass through to the animated GIF web service. This will be returned with the callback URL you have specified.
-
setWidth(int value) - the width of the resulting animated GIF in pixels.
- Default: 180px
- Maximum: Maximum width for package
- Auto-size: -1 (passing -1 means that the width of the animated GIF is scaled in relation to its height, if the width is being auto-sized the height cannot)
-
setHeight(int value) - the height of the resulting animated GIF in pixels.
- Default: 120px
- Maximum: Maximum height for package
- Auto-size: -1 (passing -1 means that the height of the animated GIF is scaled in relation to its width, if the height is being auto-sized the width cannot)
-
setStart(int value) - the starting position of the video that should be converted into a animated GIF.
-
setDuration(int value) - the length in seconds of the video that should be converted into a animated GIF.
- Default: maximum length for package
-
setSpeed(float value) - the speed of the animated GIF.
- Default: 1
- Minimum: 0.2
- Maximum: 10
-
setFramesPerSecond(float value) - the number of frames per second that should be captured from the video.
- Default: 10
- Minimum: 0.2
- Maximum: 60
-
setRepeat(int value) - number of times to loop the animated GIF.
- Default: 0
- Loop Continuously: 0
- Never Loop: -1
-
setReverse(boolean value) - if true the frames of the animated GIF are reversed
-
setCustomWaterMarkId(String value) - add a custom watermark or special watermark to the animated GIF
-
setQuality(int value) - the quality of the returned image, which has a default compression of 85%.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
setCountry(Country value) - the country the animated GIF should be taken from.
- Default: The current fastest location
- Options: Country.SINGAPORE, Country.UNITEDKINGDOM, Country.UNITEDSTATES
-
setExportURL(String value) - the export URL that specifies where the capture should be exported too
-
setEncryptionKey(String key) - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
setProxy(String proxy) - the HTTP proxy details the browser software should use to use to create this capture
URLToImage(String url, ImageOptions options)
Specifies the URL that should be converted into a image screenshot.
Parameters
-
url - the URL that the screenshot should be made of
- options - a instance of the ImageOptions class that defines any special options to use when creating the screenshot.
Return Value
void
HTMLToImage(String html, ImageOptions options)
Specifies the HTML that should be converted into a image.
Parameters
-
html - the HTML to convert into a image
- options - a instance of the ImageOptions class that defines any special options to use when creating an image.
Return Value
void
FileToImage(String path, ImageOptions options)
Specifies a HTML file that should be converted into a image.
Parameters
-
path - the file path of a HTML file to convert into a image
- options - a instance of the ImageOptions class that defines any special options to use when creating an image.
Return Value
void
ImageOptions
The class represents all of the options available when creating image captures.
Public Properties
-
setCustomId(String value) - custom identifier that you can pass through to the screenshot webservice. This will be returned with the callback URL you have specified.
-
setBrowserWidth(int value) - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
-
setBrowserHeight(int value) - the height of the browser in pixels
- Default: 1170
- Maximum: 10000
- Full Length: -1 (passing -1 means that a sceenshot of the whole web page is taken)
-
setOutputWidth(int value) - the width of the resulting thumbnail in pixels
- Default: if both the output width and output height are not specified or 0 then the output width and height will match the final image width and height, if the output height is specified the output width will be proportional to the output height
- Maximum: Maximum width for package
- Full Width: -1 (passing -1 means that the width of the thumbnail is not reduced)
-
setOutputHeight(int value) - the height of the resulting thumbnail in pixels
- Default: if both the output width and output height are not specified or 0 then the output width and height will match the final image width and height, if the output width is specified the output height will be proportional to the output width
- Maximum: Maximum height for package
- Full Height: -1 (passing -1 means that the height of the thumbnail is not reduced)
-
setFormat(ImageFormat value) - the format the screenshot should be in.
-
setDelay(int value) - the number of milliseconds to wait before taking the screenshot
- Default: 0
- Maximum: 30000
-
setClickElement(String value) - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
setTargetElement(String value) - the CSS selector of the only HTML element on the target web page that is to be turned into a screenshot, all other parts of the web page are ignored. If there are multiple matching HTML elements the first one is chosen
-
setHideElement(String value) - the CSS selectors of the one or more HTML elements in the web page to hide, to specify multiple HTML elements to hide seperate each selector with a comma
-
setWaitForElement(String value) - the CSS selectors of the HTML element in the web page that must be visible before the capture is performed
-
setRequestAs(BrowserType value) - the type of user agent you wish to use
-
setCustomWaterMarkId(String value) - add a custom watermark or special watermark to the image
-
setQuality(int value) - the quality of the returned image. This currently only effects JPG and WEBP images, which have a default compression of 90%.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
setTransparent(boolean value) - if true the image capture should be transparent. This is only compatible with png and tiff images.
-
setHd(boolean value) - if true the image capture will be in high definition this doubles the size of the image dimensions.
-
setCountry(Country value) - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: Country.SINGAPORE, Country.UNITEDKINGDOM, Country.UNITEDSTATES
-
setExportURL(String value) - the export URL that specifies where the capture should be exported too
-
setEncryptionKey(String key) - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
setNoAds(boolean noAds) - if true adverts should be automatically hidden.
-
setNoCookieNotifications(boolean noCookieNotifications) - if true all commonly found cookie notifications should be automatically hidden.
-
setAddress(String address) - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
setProxy(String proxy) - the HTTP proxy details the browser software should use to use to create this capture
Public Methods
-
AddPostParameter(String name, String value) - defines a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.
- name - the name of the HTTP Post parameter
- value - the value of the HTTP Post parameter
URLToVideo(String url, VideoOptions options)
Specifies the URL that should be converted into a video.
Parameters
-
url - the URL that the video should be captured from
-
options - a instance of the VideoOptions class that defines any special options to use when creating the video.
Return Value
void
HTMLToVideo(String html, VideoOptions options)
Specifies the HTML that the video should be captured from.
Parameters
-
html - the HTML to convert into a video
- options - a instance of the VideoOptions class that defines any special options to use when creating the video.
Return Value
void
FileToVideo(String path, VideoOptions options)
Specifies a HTML file that should be converted into a video.
Parameters
-
path - the file path of a HTML file to convert into a video
-
options - a instance of the VideoOptions class that defines any special options to use when creating the video.
Return Value
void
VideoOptions
The class represents all of the options available when creating a video of a webpage.
Public Properties
-
setCustomId(String value) - custom identifier that you can pass through to the video webservice. This will be returned with the callback URL you have specified.
-
setCustomWaterMarkId(String value) - add a custom watermark or special watermark to the video
-
setBrowserWidth(int value) - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
-
setBrowserHeight(int value) - the height of the browser in pixels
- Default: 1170
- Maximum: 10000
-
setOutputWidth(int value) - the width of the resulting video in pixels
- Default: if not set it will match the browser width
- Maximum: Maximum width for package
-
setOutputHeight(int value) - the height of the resulting video in pixels
- Default: if not set it will match the browser height
- Maximum: Maximum height for package
-
setStart(int value) - the number of milliseconds to wait before creating the video
- Default: 0
- Maximum: 30000
-
setClickElement(String value) - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
setWaitForElement(String value) - the CSS selectors of the HTML element in the web page that must be visible before the video is rendered
-
setRequestAs(BrowserType value) - the type of user agent you wish to use
-
setCountry(Country value) - the country in which the web page should be loaded.
-
setExportURL(String value) - the export URL that specifies where the capture should be exported too
-
setEncryptionKey(String key) - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
setNoAds(boolean noAds) - if true adverts should be automatically hidden.
-
setNoCookieNotifications(boolean noCookieNotifications) - if true all commonly found cookie notifications should be automatically hidden.
-
setAddress(String address) - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
setProxy(String proxy) - the HTTP proxy details the browser software should use to use to create this capture
-
setFramesPerSecond(float value) - the number of frames per second (or screenshots per second) that that should be used when creating the video.
- Default: 10
- Minimum: 0.2
- Maximum: 20
-
setDuration(int value) - the length in seconds of the video, this will be how long the web page is captured for.
- Default: 10
- Minimum: 1
- Maximum: 60
Public Methods
-
AddPostParameter(string name, string value) - defines a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.
- name - the name of the HTTP Post parameter
- value - the value of the HTTP Post parameter
URLToRenderedHTML(String url, HTMLOptions options)
Specifies the URL that should be converted into rendered HTML.
Parameters
-
url - the URL that the rendered HTML should be made of
-
options - a instance of the HTMLOptions class that defines any special options to use when creating the rendered HTML.
Return Value
void
HTMLToRenderedHTML(string html, HTMLOptions options)
Specifies the HTML that should be converted into rendered HTML.
Parameters
-
html - the HTML to convert into rendered HTML
- options - a instance of the HTMLOptions class that defines any special options to use when creating rendered HTML.
Return Value
void
FileToRenderedHTML(string path, HTMLOptions options)
Specifies a HTML file that should be converted into rendered HTML.
Parameters
-
path - the file path of a HTML file to convert into rendered HTML
-
options - a instance of the HTMLOptions class that defines any special options to use when creating rendered HTML.
Return Value
void
HTMLOptions
The class represents all of the options available when creating rendered HTML captures.
Public Properties
Public Methods
-
AddPostParameter(String name, String value) - defines a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.
- name - the name of the HTTP Post parameter
- value - the value of the HTTP Post parameter
URLToPDF(String url, PDFOptions options)
Specifies the URL that should be converted into a PDF.
Parameters
-
url - the URL that the should be converted into a PDF
- PDFOptions options - a instance of the PDFOptions class that defines any special options to use when creating a PDF.
Return Value
void
HTMLToPDF(String html, PDFOptions options)
Specifies the HTML that should be converted into a PDF.
Parameters
-
html - the HTML to convert into a PDF
- PDFOptions options - a instance of the PDFOptions class that defines any special options to use when creating a PDF.
Return Value
void
FileToPDF(String path, PDFOptions options)
Specifies a HTML file that should be converted into a PDF.
Parameters
-
path - the file path of a HTML file to convert into a PDF
- PDFOptions options - a instance of the PDFOptions class that defines any special options to use when creating a PDF.
Return Value
void
PDFOptions
The class represents all of the options available when creating PDF captures.
Public Properties
-
setCustomId(String value) - a custom identifier that you can pass through to the webservice. This will be returned with the callback URL you have specified.
-
setIncludeBackground(boolean value) - if true the background of the web page should be included in the screenshot
-
setPageSize(PageSize value) - the page size of the PDF
-
setOrientation(PageOrientation value) - the orientation of the PDF document
-
setCSSMediaType(CSSMediaType value) - the CSS Media Type of the PDF document
-
setIncludeLinks(boolean value) - true if links should be included in the PDF
-
setIncludeOutline(boolean value) - true if PDF bookmarks should be included
-
setTitle(String value) - provide a title to the PDF document
-
setCoverURL(string value) - the URL of a web page that should be used as a cover page for the PDF
-
setMarginTop(int value) - the margin in millimeters that should appear at the top of the PDF document page
-
setMarginLeft(int value) - the margin in millimeters that should appear at the left of the PDF document page
-
setMarginBottom(int value) - the margin in millimeters that should appear at the bottom of the PDF document page
-
setMarginRight(int value) - the margin in millimeters that should appear at the right of the PDF document
-
setBrowserWidth(int value) - the the width of the browser in pixels
- Default: 1366
- Maximum: 10000
- Auto Width: -1 (passing -1 means that the width of the browser matches the width of the PDF document)
-
setPageWidth(int value) - the custom width of the resulting PDF in mm
-
setPageHeight(int value) - the custom height of the resulting PDF in mm
- Default: PageSize height
- Minimum: 15
- Full Length: -1 (passing -1 means that the page height is equal to the web page)
-
setDelay(int value) - the number of milliseconds to wait before taking the screenshot
- Default: 0
- Maximum: 30000
-
setRequestAs(BrowserType value) - the type of user agent you wish to use
-
setTemplateId(String value) - add a template ID that specifies the header and footer of the PDF document
-
setClickElement(String value) - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
setTargetElement(String value) - the CSS selector of the only HTML element on the target web page that is to be turned into a PDF, all other parts of the web page are ignored. If there are multiple matching HTML elements the first one is chosen
-
setHideElement(String value) - the CSS selectors of the one or more HTML elements in the web page to hide, to specify multiple HTML elements to hide seperate each selector with a comma
-
setWaitForElement(String value) - the CSS selectors of the HTML element in the web page that must be visible before the capture is performed
-
setCustomWaterMarkId(String value) - add a custom watermark or special watermark to each page of the PDF document
-
setQuality(int value) - the quality of the returned PDF. The default uses the recommended quality for the PDF.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
setCountry(Country value) - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: Country.SINGAPORE, Country.UNITEDKINGDOM, Country.UNITEDSTATES
-
setExportURL(String value) - the export URL that specifies where the capture should be exported too
-
setEncryptionKey(String key) - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
setNoAds(boolean noAds) - if true adverts should be automatically hidden.
-
setNoCookieNotifications(boolean noCookieNotifications) - if true all commonly found cookie notifications should be automatically hidden.
-
setAddress(String address) - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
setProxy(String proxy) - the HTTP proxy details the browser software should use to use to create this capture
-
setMergeId(String mergeId) - the ID of a capture that should be merged at the beginning of the new PDF document
-
setPassword(String password) - the password to protect the PDF document with
Public Methods
-
AddPostParameter(String name, String value) - defines a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.
- name - the name of the HTTP Post parameter
- value - the value of the HTTP Post parameter
-
AddTemplateParameter(String name, String value) - define a custom template parameter and value, this method can be called multiple times to add multiple parameters.
- name - the name of the template parameter
- value - the value of the template parameter
URLToDOCX(String url, DOCXOptions options)
Specifies the URL that should be converted into a DOCX.
Parameters
-
url - the URL that the should be converted into a DOCX
- DOCXOptions options - a instance of the DOCXOptions class that defines any special options to use when creating a DOCX.
Return Value
void
HTMLToDOCX(String html, DOCXOptions options)
Specifies the HTML that should be converted into a DOCX.
Parameters
-
html - the HTML to convert into a DOCX
- DOCXOptions options - a instance of the DOCXOptions class that defines any special options to use when creating a DOCX.
Return Value
void
FileToDOCX(String path, DOCXOptions options)
Specifies a HTML file that should be converted into a DOCX.
Parameters
-
path - the file path of a HTML file to convert into a DOCX
- DOCXOptions options - a instance of the DOCXOptions class that defines any special options to use when creating a DOCX.
Return Value
void
DOCXOptions
The class represents all of the options available when creating DOCX captures.
Public Properties
-
setCustomId(String value) - a custom identifier that you can pass through to the webservice. This will be returned with the callback URL you have specified.
-
setIncludeBackground(boolean value) - if true the background images of the web page should be included in the DOCX
-
setPageSize(PageSize value) - the page size of the DOCX
-
setOrientation(PageOrientation value) - the orientation of the DOCX document
-
setIncludeLinks(boolean value) - true if links should be included in the DOCX
-
setIncludeImages(boolean value) - if true the images of the web page should be included in the DOCX
-
setTitle(String value) - provide a title to the DOCX document
-
setMarginTop(int value) - the margin in millimeters that should appear at the top of the DOCX document page
-
setMarginLeft(int value) - the margin in millimeters that should appear at the left of the DOCX document page
-
setMarginBottom(int value) - the margin in millimeters that should appear at the bottom of the DOCX document page
-
setMarginRight(int value) - the margin in millimeters that should appear at the right of the DOCX document
-
setBrowserWidth(int value) - the width of the browser in pixels
- Default: 1366
- Maximum: 10000
- Auto Width: -1 (passing -1 means that the width of the browser matches the width of the PDF document)
-
setPageWidth(int value) - the custom width of the resulting DOCX in mm
-
setPageHeight(int value) - the custom height of the resulting DOCX in mm
-
setDelay(int value) - the number of milliseconds to wait before taking the screenshot
- Default: 0
- Maximum: 30000
-
setRequestAs(BrowserType value) - the type of user agent you wish to use
-
setTemplateId(String value) - add a template ID that specifies the header and footer of the DOCX document
-
setClickElement(String value) - this specifies the HTML element, using a CSS selector to click. Remember a delay may also be required to view the effects of the click
-
setTargetElement(String value) - the CSS selector of the only HTML element on the target web page that is to be turned into a screenshot, all other parts of the web page are ignored. If there are multiple matching HTML elements the first one is chosen
-
setHideElement(String value) - the CSS selectors of the one or more HTML elements in the web page to hide, to specify multiple HTML elements to hide seperate each selector with a comma
-
setWaitForElement(String value) - the CSS selectors of the HTML element in the web page that must be visible before the capture is performed
-
setQuality(int value) - the quality of the returned DOCX. The default uses the recommended quality for the DOCX.
- Reducing the quality will reduce the filesize and reduce download times.
- Default: -1
- Minimum: -1
- Maximum: 100
-
setCountry(Country value) - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: Country.SINGAPORE, Country.UNITEDKINGDOM, Country.UNITEDSTATES
-
setExportURL(String value) - the export URL that specifies where the capture should be exported too
-
setEncryptionKey(String key) - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
setNoAds(boolean noAds) - if true adverts should be automatically hidden.
-
setNoCookieNotifications(boolean noCookieNotifications) - if true all commonly found cookie notifications should be automatically hidden.
-
setAddress(String address) - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
setProxy(String proxy) - the HTTP proxy details the browser software should use to use to create this capture
-
setMergeId(String mergeId) - the ID of a capture that should be merged at the beginning of the new DOCX document
-
setPassword(String mergeId) - the password to protect the DOCX document with
Public Methods
-
AddPostParameter(String name, String value) - defines a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.
- name - the name of the HTTP Post parameter
- value - the value of the HTTP Post parameter
-
AddTemplateParameter(String name, String value) - define a custom template parameter and value, this method can be called multiple times to add multiple parameters.
- name - the name of the template parameter
- value - the value of the template parameter
URLToTable(String url, TableOptions options)
Specifies the URL that the HTML tables should be extracted from.
Parameters
-
url - the URL to extract HTML tables from
- TableOptions options - a instance of the TableOptions class that defines any special options to use when converting the HTML table.
Return Value
void
HTMLToTable(String html, TableOptions options)
Specifies the HTML that the HTML tables should be extracted from.
Parameters
-
html - the HTML to extract HTML tables from.
- TableOptions options - a instance of the TableOptions class that defines any special options to use when converting the HTML table.
Return Value
void
FileToTable(String path, TableOptions options)
Specifies a HTML file that the HTML tables should be extracted from.
Parameters
-
path - the file path of a HTML file to extract HTML tables from.
- TableOptions options - a instance of the TableOptions class that defines any special options to use when converting the HTML table.
Return Value
void
TableOptions
The class represents all of the options available when converting HTML tables to CSV, XLSX or JSON.
Public Properties
-
setCustomId(String value) - a custom identifier that you can pass through to the webservice. This will be returned with the callback URL you have specified
-
setTableNumberToInclude(int value) - the index of the table to be converted, were all tables in a web page are ordered from the top of the web page to bottom
-
setFormat(TableFormat value) - the format the table should be in
-
setIncludeHeaderNames(boolean value) - if true header names will be included in the table
-
setIncludeAllTables(boolean value) - if true all table on the web page will be extracted with each table appearing in a seperate spreadsheet sheet. Only available with the XLSX format
-
setTargetElement(String value) - the id of the only HTML element in the web page that should be used to extract tables from
-
setRequestAs(BrowserType value) - the type of user agent you wish to use
-
setCountry(Country value) - the country the screenshot should be taken from.
- Default: The current fastest location
- Options: Country.SINGAPORE, Country.UNITEDKINGDOM, Country.UNITEDSTATES
-
setExportURL(String value) - the export URL that specifies where the capture should be exported too
-
setEncryptionKey(String key) - if a base 64 encoded AES encryption key is specified your capture is encrypted when it is created. It is recommended to use the create encryption key method to create the key and the decrypt methods to decrypt the encrypted capture as shown in this example.
-
setAddress(String address) - the URL to execute the HTML code in. Can be useful if the HTML being converted uses relative URL's for resources such as CSS and images.
-
setProxy(String proxy) - the HTTP proxy details the browser software should use to use to create this capture
Public Methods
-
AddPostParameter(String name, String value) - defines a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.
- name - the name of the HTTP Post parameter
- value - the value of the HTTP Post parameter
Save()
Save the result asynchronously and returns a unique identifier, which can be used to get the screenshot with the GetResult method.
Return Value
The unique identifier of the screenshot otherwise if a error has occured an exception is thrown. This can be used to get the screenshot with the GetResult method
This is the recommended method of saving a file
Save(String callBackURL)
Save the result asynchronously and returns a unique identifier, which can be used to get the screenshot with the GetResult method.
Parameters
-
callBackURL - the handler the GrabzIt service should call after it has completed its work
Return Value
The unique identifier of the screenshot otherwise if a error has occured an exception is thrown. This can be used to get the screenshot with the GetResult method
Warning this method is synchronous so will cause a application to pause while the result is processed
Save the result synchronously to a GrabzItFile object.
Return Value
GrabzItFile object
Warning this method is synchronous so will cause a application to pause while the result is processed
SaveTo(String saveToFile)
Save the result synchronously to a file.
Parameters
-
saveToFile - the file path that capture will be saved to once it has been completed
Return Value
returns the true if it is successful otherwise it throws an exception.
Status GetStatus(String id)
Get the current status of a GrabzIt screenshot.
Parameters
-
id - the unique identifier of the screenshot
Return Value
Status object
Get all the cookies that GrabzIt is using for a particular domain. This may include user defined cookies as well.
Parameters
-
domain - the domain to return cookies for
Return Value
GrabzItCookie array
SetCookie(String name, String domain, String value, String path, boolean httponly, Date expires)
Sets a new custom cookie on GrabzIt, if the custom cookie has the same name and domain as a global cookie the global cookie is overridden.
This can be useful if a websites functionality is controlled by cookies.
Parameters
-
name - the name of the cookie to set
-
domain - the domain of the website to set the cookie for
- value - the value of the cookie
- path - the website path the cookie relates to
- httponly - if true the cookie can only be used with the HTTP protocol
- expires - defines when the cookie expires. Pass a null value if the cookie should not expire
Return Value
True if the cookie is successfully set, otherwise false
DeleteCookie(String name, String domain)
Delete a custom cookie or block a global cookie from being used
Parameters
-
name - the name of the cookie to delete
-
domain - the domain of the website to delete the cookie for
Return Value
True if the cookie is successfully deleted, otherwise false
Get all your uploaded custom watermarks
Return Value
WaterMark array
WaterMark GetWaterMark(String identifier)
Return your custom watermarks that matches the specified identifier
Parameters
-
identifier - the identifier of a particular custom watermark you want to view
Return Value
WaterMark object
Add a new custom watermark
Parameters
-
identifier - the identifier you want to give the custom watermark. It is important that this identifier is unique.
-
path - the absolute path of the watermark on your server. For instance C:/watermark/1.png
-
xpos - the horizontal position you want the screenshot to appear at
-
ypos - vertical position you want the screenshot to appear at
Return Value
returns true if the watermark was successfully set
DeleteWaterMark(String identifier)
Delete a custom watermark
Parameters
-
identifier - the identifier of the custom watermark you want to delete
Return Value
returns true if the watermark was successfully deleted
SetLocalProxy(String proxyUrl)
This method enables a local proxy server to be used for all requests.
Parameters
-
proxyUrl - the URL, which can include a port if required, of the proxy. Providing a null will remove any previously set proxy
UseSSL(boolean value)
Specifies if requests to GrabzIt's API should use SSL
Parameters
-
value - if true all requests to GrabzIt's API will use SSL
String CreateEncryptionKey()
Create a cryptographically secure base 64 encryption key, 44 characters long.
Decrypt(String path, String key)
Decrypt an encrypted capture using the provided encryption key.
Parameters
GrabzItFile Decrypt(GrabzItFile file, String key)
Decrypt an encrypted capture using the provided encryption key.
Parameters
byte[] Decrypt(byte[] data, String key)
Decrypt an encrypted capture using the provided encryption key.
Parameters
Enums
ImageFormat
This enum comprises of the following values.
- BMP8
- BMP16
- BMP24
- BMP
- JPG
- TIFF
- PNG
- WEBP
BrowserType
This enum comprises of the following values.
- STANDARDBROWSER
- MOBILEBROWSER
- SEARCHENGINE
Country
This enum comprises of the following values.
- DEFAULT
- SINGAPORE
- UNITEDKINGDOM
- UNITEDSTATES
PageSize
This enum comprises of the following values.
- A3
- A4
- A5
- A6
- B3
- B4
- B5
- B6
- LEGAL
- LETTER
PageOrientation
This enum comprises of the following values.
CSSMediaType
This enum comprises of the following values.
TableFormat
This enum comprises of the following values.
HorizontalPosition
This enum comprises of the following values.
VerticalPosition
This enum comprises of the following values.
Result Classes
Cookie
Public Properties
-
String getName()
-
String getValue()
-
String getDomain()
- The domain the cookie is set for.
-
String getPath()
- The path on the domain that this cookie applies to.
-
String getHttpOnly()
- If this cookie is only valid when the website is viewed with the HTTP protocol.
-
String getExpires()
- The date this cookie expires
-
String getType()
-
The type of cookie this is, which can be one of the following:
- Global - this is a global cookie set by GrabzIt
- Local - this is a local cookie set by you
- Overridden - a global cookie that has been overridden by you
GrabzItFile
Public Methods
- byte[] getBytes()
- void Save(String path)
- String toString()
Status
The class representing the current status of the screenshot.
Public Methods
-
boolean isProcessing()
- If true the screenshot is still being processed.
-
boolean isCached()
- If true the screenshot is has been processed and is currently cached.
-
boolean isExpired()
- If true the screenshot is no longer on the GrabzIt system.
-
String getMessage()
- An error message returned by the system.
WaterMark
This class represents the custom watermarks stored in GrabzIt
Public Methods