Screenshot

The Screenshot APIs are used to take screenshots of HTML content and URLs. On this page, we'll dive into the different screenshot endpoints you can use.


POST/v1/screenshot/url

Take a screenshot of a URL

This endpoint allows you to take a screenshot of a URL

Required attributes

  • Name
    url
    Type
    string
    Description

    The URL to take screenshot of

Optional attributes

  • Name
    engine_options
    Type
    object
    Description

    Screenshot engine options

    • Name
      timeout
      Type
      integerDefault: 30000
      Description

      Timeout in milliseconds.

    • Name
      waitForNetworkToIdle
      Type
      booleanDefault: false
      Description

      If enabled, the engine will wait for the network activity to stop before taking action. If you get partial renderings, setting this to true might help.

  • Name
    options
    Type
    object
    Description

    Page options

    • Name
      type
      Type
      stringDefault: png
      Description

      Generated image format. Allowed: ['png', 'jpeg', 'webp']

    • Name
      captureBeyondViewport
      Type
      booleanDefault: false
      Description

      Print background graphics.

    • Name
      omitBackground
      Type
      booleanDefault: false
      Description

      Hides default white background and allows generating pdfs with transparency.

    • Name
      fullPage
      Type
      numberDefault: 1
      Description

      Scales the rendering of the web page. Amount must be between 0.1 and 2.

    • Name
      quality
      Type
      booleanDefault: false
      Description

      Whether to show the header and footer.

    • Name
      clip
      Type
      object
      Description

      Page Margin

      • Name
        x
        Type
        integer
        Description
      • Name
        y
        Type
        integer
        Description
      • Name
        width
        Type
        integer
        Description
      • Name
        height
        Type
        integer
        Description
      • Name
        scale
        Type
        integer
        Description

Request

POST
/v1/screenshot/url
curl -X POST https://api.pdfloom.com/convert/url \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
    "url": "https://example.com",
    "options": {
        "page_size": "A4",
        "orientation": "portrait"
    }
}'

Response

{
    "success": true,
    "response": "https://pdfloom-processed.s3.amazonaws.com/users/1/ss/5663a0ad-6c81-4ec2-bdea-88ac6d2efc30.png?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVXUMWHOQWRBIZZCO%2F20240815%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240815T110315Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1800&X-Amz-Signature=43cedcfb340a7261a2cb660feb47c6dadcd7c8be75b08dccc43eaa77da2555c7",
    "fileSize": 65740
}

POST/v1/screenshot/html

Take a screenshot of HTML content

This endpoint allows you to send a new message to one of your conversations.

Required attributes

  • Name
    content
    Type
    string
    Description

    The HTML content to take screenshot of

Optional attributes

  • Name
    engine_options
    Type
    object
    Description

    Screenshot engine options

    • Name
      timeout
      Type
      integerDefault: 30000
      Description

      Timeout in milliseconds.

    • Name
      waitForNetworkToIdle
      Type
      booleanDefault: false
      Description

      If enabled, the engine will wait for the network activity to stop before taking action. If you get partial renderings, setting this to true might help.

  • Name
    options
    Type
    object
    Description

    Page options

    • Name
      type
      Type
      stringDefault: png
      Description

      Generated image format. Allowed: ['png', 'jpeg', 'webp']

    • Name
      captureBeyondViewport
      Type
      booleanDefault: false
      Description

      Print background graphics.

    • Name
      omitBackground
      Type
      booleanDefault: false
      Description

      Hides default white background and allows generating pdfs with transparency.

    • Name
      fullPage
      Type
      numberDefault: 1
      Description

      Scales the rendering of the web page. Amount must be between 0.1 and 2.

    • Name
      quality
      Type
      booleanDefault: false
      Description

      Whether to show the header and footer.

    • Name
      clip
      Type
      object
      Description

      Page Margin

      • Name
        x
        Type
        integer
        Description
      • Name
        y
        Type
        integer
        Description
      • Name
        width
        Type
        integer
        Description
      • Name
        height
        Type
        integer
        Description
      • Name
        scale
        Type
        integer
        Description

Request

POST
/v1/screenshot/html
curl -X POST https://api.pdfloom.com/convert/html \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
    "url": "https://example.com",
    "options": {
        "page_size": "A4",
        "orientation": "portrait"
    }
}'

Response

{
    "success": true,
    "response": "https://pdfloom-processed.s3.amazonaws.com/users/1/ss/5663a0ad-6c81-4ec2-bdea-88ac6d2efc30.png?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVXUMWHOQWRBIZZCO%2F20240815%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240815T110315Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1800&X-Amz-Signature=43cedcfb340a7261a2cb660feb47c6dadcd7c8be75b08dccc43eaa77da2555c7",
    "fileSize": 65740
}

Was this page helpful?