Operations

Capture Website

Convert a website to PDF or capture a screenshot of a website (PNG, JPG).

To create a website screenshot, create a job with a capture-website task.

The available parameters differ based on output_format. Select a value below to show all available conversion options.

Task Parameters

operation
string required
Value is capture-website.
url
string required

URL of the website

output_format
string required

The target format to convert to.

engine
string

Use a specific engine for the conversion.

engine_version
string

Use a specific engine version for the conversion.

filename
string

Choose a filename (including extension) for the output file.

timeout
integer

Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Example Job

Using the parameters from above, you can create a job:

POSThttps://api.cloudconvert.com/v2/jobs
Use the Job Builder to generate and try out capture-website jobs.

To add a custom header and/or footer, use header_template and footer_template. These parameters need to be set to the name of another import task, containing the templates. For example, you can use import/raw to provide these templates. As shown in the example below, you can use the magic CSS classes date, title, url, pageNumber, totalPages.

Alongside header_template / footer_template you need to set display_header_footer to true and and some spacing with margin_topand margin_bottom to show the header / footer.

{
  "tasks": {
    "import-my-footer": {
      "operation": "import/raw",
      "filename": "footer.html",
      "file": "<span style='font-size: 10px'> Page <span class='pageNumber'></span> / <span class='totalPages'></span> </span>"
    },
    "import-my-header": {
      "operation": "import/raw",
      "filename": "header.html",
      "file": "<span style='font-size: 10px'> This is a header. Date: <span class='date'></span> </span>"
    },
    "capture-my-website": {
      "operation": "capture-website",
      "url": "https://cloudconvert.com",
      "output_format": "pdf",
      "margin_top": 20,
      "margin_bottom": 20,
      "display_header_footer": true,
      "footer_template": "import-my-footer",
      "header_template": "import-my-header",
    },
    "export-my-file": {
      "operation": "export/url",
      "input": "capture-my-website"
    }
  }
}