View as Markdown
Urlbox.io icon

Urlbox.io ACTION

Generate Screenshot From HTML

Generate a screenshot of a website provided by a html. See the docs here
  • Action
  • Writes data
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Urlbox.io account once, then configure and run Generate Screenshot From HTML from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "urlbox_io-generate-screenshot-from-html",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    urlbox_io: { authProvisionId: "apn_xxxxxxx" },
    html: "HTML",
    format: "Format",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Generate Screenshot From HTML inputs
Property Type Description
html HTML string
The html that you want to take a screenshot.
Required
format Format string
Format of the resulting screenshot image. Default is PNG
Required
width Width integer
Viewport width of the browser in pixels. Default is 1280.
Optional
height Height integer
Viewport height of the browser in pixels. Default is 1024.
Optional
fullPage Full Page boolean
Specify whether to capture the full-length of the website. Default is FALSE.
Optional
selector Selector string
Take a screenshot of the element that matches this selector.
Optional
gpu GPU boolean
Enable GPU acceleration to render 3D scenes and heavy WebGL content. This is a beta feature and requires pre-approval. Please contact support to enable this feature on your account.
Optional
blockAds Block Ads boolean
Blocks requests from popular advertising networks from loading.
Optional
blockUrls Block Urls string
Block requests from specific urls from loading.
Optional
hideCookieBanners Hide Cookie Banners boolean
Automatically hides cookie banners from most websites.
Optional
clickAccept Click Accept boolean
Automatically clicks 'Accept' buttons, in order to dismiss popups.
Optional
hideSelector Hide Selector string
Hides all elements that match the element selector by setting their style to display:none !important;. Useful for hiding popups.
Optional
js JS string
Inject (and execute) custom JavaScript on the page.
Optional
css CSS string
Inject custom CSS into the page.
Optional
darkMode Dark Mode boolean
Emulate dark mode on websites by setting prefers-color-scheme: dark.
Optional
retina Retina boolean
Take a 'retina' or high definition screenshot equivalent to setting a device pixel ratio of 2.0 or @2x. Please note that retina screenshots will be double the normal dimensions and will normally take slightly longer to process due to the much bigger image size. Default is FALSE
Optional
thumbWidth Thumb Width string
The width of the generated thumbnail, in pixels. Omit for a full-size screenshot.
Optional
thumbHeight Thumb Height string
The height of the generated thumbnail, in pixels. Omit for a full-size screenshot.
Optional
quality Quality integer
The image quality of the resulting screenshot (JPEG/WebP only). Default is 80.
Optional
transparent Transparent boolean
If a website has no background color set, the image will have a transparent background (PNG/WebP only).
Optional
maxHeight Max Height string
For extremely lengthy websites, it may be preferable to limit the screenshot to a maximum height to prevent Urlbox from spending time scrolling and generating an enormous screenshot.
Optional
download Download string
Pass in a filename which sets the content-disposition header on the response. E.g. download=myfilename.png This will make the Urlbox link downloadable, and will prompt the user to save the file as myfilename.png
Optional
pdfPageSize PDF Page Size string
Sets the PDF page size. Setting this option will take precedence over pdf_page_width and pdf_page_height.
Optional
pdfPageWidth PDF Page Width integer
Sets the PDF page width, in pixels.
Optional
pdfPageHeight PDF Page Height integer
Sets the PDF page height, in pixels.
Optional
pdfMargin PDF Margin string
Sets the margin of the PDF document.
Optional
pdfMarginTop PDF Margin Top integer
Sets a custom top margin on the PDF.
Optional
pdfMarginRight PDF Margin Right integer
Sets a custom right margin on the PDF.
Optional
pdfMarginBottom PDF Margin Bottom integer
Sets a custom bottom margin on the PDF.
Optional
pdfMarginLeft PDF Margin Left integer
Sets a custom left margin on the PDF.
Optional
pdfScale PDF Scale string
Sets the scale factor of the website content in the PDF. Valid values are numbers between 0.1 and 2. Default is 1
Optional
pdfOrientation PDF Orientation string
Sets the orientation of the PDF.
Optional
pdfBackground PDF Background boolean
Sets whether to print background images in the PDF.
Optional
disableLigatures Disable Ligatures boolean
Prevents ligatures from being used. Useful when rendering a PDF, and you want to extract text which contains ligatures.
Optional
media Media string
By default, when generating a PDF, the print CSS media query is used. To generate a PDF using the screen CSS, set this option to screen.
Optional
force Force boolean
Generate a fresh screenshot or PDF, instead of getting a cached version.
Optional
unique Unique string
Pass a unique string such as a UUID, hash or timestamp, to have more control over when to generate a fresh screenshot or PDF. For example, you could do something like unique=$1681161683702 to get a new value for unique each time it is called.
Optional
ttl ttl integer
Short for 'time to live'. Number of seconds to keep a screenshot in the cache. Note the default is also the maximum value for this option. Default is 2592000 (30 days - this is also the maximum value).
Optional
proxy Proxy string
Pass in a proxy server address to make screenshot requests via that server in the format [address]:[port]. If proxy authentication is required, you can use the following format: [user]:[password]@[address]:[port].
Optional
header Header string
Set a header on the request when loading the URL. Example: To set the header with key X-My-Header to the value SomeValue, you would pass header=X-My-Header%3DSomeValue. This can be set multiple times, to set more than one header - e.g. header=X-My-Header%3DSomeValue&header=X-My-Other-Header%3DSomeOtherValue. As with all options passed via the query string, the header value must be URL encoded - so X-My-Header=SomeValue becomes X-My-Header%3DSomeValue in order to be interpreted correctly by Urlbox.
Optional
cookie Cookie string
Sets a cookie on the request when loading the URL. Example: To set the cookie with key Opt-In to the value yes, you would pass cookie=Opt-In%3Dyes. This can be set multiple times, to set more than one cookie - e.g.cookie=Opt-In%3Dyes&cookie=Session-Id%3DMTIzNDU. As with all options passed in the query string, the cookie value must be URL encoded - so OptIn=true becomes OptIn%3Dtrue in order to be interpreted correctly by Urlbox.
Optional
userAgent User Agent string
Sets the User-Agent string for the request.
Optional
acceptLang Accept Lang string
Sets an Accept-Language header on requests to the target URL. Default is en-US.
Optional
authorization Authorization string
Sets an Authorization header on requests to the target URL. Can be used to pass an auth token through to the site in order to 'login' before rendering.
Optional
tz TZ string
Sets the local timezone to use for the screenshot. Default is UTC
Optional
delay Delay string
Amount of time to wait in milliseconds before urlbox takes the screenshot.
Optional
timeout Timeout integer
Amount of time to wait in milliseconds for the website at url to respond. Default is 30000.
Optional
waitUntil Wait Until string
Waits until the specified DOM event has fired before taking a screenshot or PDF.
Optional
waitFor Wait For string
Waits for the element specified by this selector to be present in the DOM before taking a screenshot or pdf. By default, Urlbox will take a screenshot or PDF if the wait_for element is not found after waiting for the time specified by the wait_timeout option. If you prefer Urlbox to fail the request when the wait_for element is not found, pass fail_if_selector_missing=true
Optional
waitToLeave Wait To Leave string
Waits for the element specified by this selector to be absent from the DOM before taking a screenshot or PDF. A typical use-case would be waiting for loading spinners to be absent before taking a screenshot. By default, Urlbox will take a screenshot or PDF if the wait_to_leave element is still present after the time specified by the wait_timeout option. If you prefer Urlbox to fail the request when the wait_to_leave element is still present, pass fail_if_selector_present=true
Optional
waitTimeout Wait Timeout integer
The amount of time to wait for the wait_for element to be available before continuing, in milliseconds. Default is 30000 (30 seconds)
Optional
scrollto Scroll To string
Scroll, to either an element or to a pixel offset from the top, before taking a screenshot of PDF.
Optional
click Click string
Specifies an element selector to click before generating a screenshot or PDF. Example: #clickme would click an element with id="clickme". Can be used multiple times to simulate multiple sequential click events. If the selector matches multiple elements, only the first element will be clicked.
Optional
clickAll Click All string
Specifies an element selector to click before generating a screenshot or PDF. Example: .clickme would click all elements with class="clickme". Can be used multiple times to simulate multiple sequential click events. If the selector matches multiple elements, all elements will be clicked.
Optional
hover Hover string
Specifies an element selector to hover over before generating a screenshot or PDF. Example: #hoverme would hover over the element with id="clickme".
Optional
bgColor Bg Color string
Specify a hex code or CSS color string to use as the background color. Some websites don't set a body background colour, and will show up as transparent backgrounds with PNG, or black when using JPG. Use this setting to set a background colour. If the website explicitly sets a transparent background on the html or body elements, this setting will be overridden.
Optional
disable_js Disable JS boolean
Turn off javascript on target url to prevent popups. Enabling this option will prevent full_page=true and many other options, because having javascript disabled prevents Urlbox from evaluating code inside the page's context.
Optional
fullWidth Full Width boolean
When full_page=true, specify whether to capture the full width of the website, for example if the site is horizontally scrolling.
Optional
allowInfinite Allow Infinite boolean
By default, when Urlbox detects an infinite scrolling page, it does not attempt to continue scrolling to the bottom, as this could result in infinite scrolling! If you want to override this behaviour, pass true for this option.
Optional
skipScroll Skip Scroll boolean
Enabling skip_scroll will speed up renders by skipping an initial scroll through the page, which is used to trigger any lazy loading elements.
Optional
detectFullHeight Detect Full Height string
Some pages have full-height backgrounds whose heights are set to 100% of the viewport. This can cause the backgrounds to get stretched when making a full page screenshot. If you are seeing this behaviour in your full page screenshots, pass true for this option.
Optional
maxSectionHeight Max Section Height integer
When Urlbox takes a full_page screenshot, the maximum height of each image section is set to 4096 pixels. If a sites height is greater than this value, Urlbox will start splitting the screenshot into sections. Sometimes it is worthwhile experimenting with this number. Default is 4096.
Optional
scrollIncrement Scroll Increment string
Sets how many pixels to scroll when scrolling the page to trigger lazy loading elements. By default, the scroll increment is set to the browser viewport height. Some pages' lazy loading elements only trigger when the scroll increment is smaller than this, however, e.g. 400px.
Optional
scrollDelay Scroll Delay string
When Urlbox decides to split a screenshot into multiple sections, the scroll delay is the time to wait between taking the screenshots of each individual section, in milliseconds. While Urlbox does detect animations, and attempts to wait for them before taking a screenshot, this option could be used to force Urlbox to wait for a certain amount of time after scrolling to the next section, to wait for things like animations to finish.
Optional
turbo Turbo string
Warning This is an experimental option. Used to speed up full page screenshots, but at the expense of accuracy.
Optional
highlight Highlight string
Word to highlight on the page before capturing a screenshot.
Optional
highlightfg Highlight Fg string
Text color of the highlighted word. Default is white.
Optional
highlightbg Highlight Bg string
Background color of the highlighted word. Default is red.
Optional
latitude Latitude string
Sets the latitude used to emulate the Geolocation API.
Optional
longitude Longitude string
Sets the longitude used to emulate the Geolocation API.
Optional
accuracy Accuracy string
Sets the accurate of the Geolocation API, in metres.
Optional
useS3 Use S3 boolean
Save the screenshot directly to the S3 bucket configured on your account.
Optional
s3Path S3 Path string
Sets the S3 path, including subdirectories and the filename, to use when saving the screenshot in your S3 bucket. The extension (.png, .jpg or .pdf) will be provided automatically, and should not be included in s3_path.
Optional
s3Bucket S3 Bucket string
Overrides the configured S3 bucket to use when saving the screenshot.
Optional
s3StorageClass S3 Storage Class string
Sets the s3 storage class.
Optional
failIfSelectorMissing Fail If Selector Missing boolean
Fails the request if the elements specified by selector or wait_for options are not found on the page after waiting for wait_timeout.
Optional
failIfSelectorPresent Fail If Selector Present boolean
Fails the request if the element specified by wait_to_leave option is found on the page after waiting for wait_timeout.
Optional
failOn4xx Fail On 4XX boolean
If fail_on_4xx=true and the requested URL returns a status code between 400 and 499, Urlbox will fail the request with error code 400 and the message: Failed to render. Requested URL returned a 4xx error code and fail_on_4xx was true.
Optional
failOn5xx Fail On 5XX boolean
If fail_on_5xx=true and the requested URL returns a status code between 500 and 599, Urlbox will fail the request with error code 400 and message: Failed to render. Requested URL returned a 5xx error code and fail_on_5xx was true.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
urlbox_io-generate-screenshot-from-html
Version
0.0.3
App
Urlbox.io
Authentication
API key
Read-only
No
Destructive
No
Open world
Yes