Skip to main content
POST

Request Parameters

Body

string
The HTML content to convert to image or PDF. Either html or url is required, but not both.
string
The URL of the webpage to capture. Either html or url is required, but not both.
string
default:"png"
The output file format. Supported formats:
  • png - PNG image format
  • jpeg - JPEG image format
  • webp - WebP image format
  • pdf - PDF document
number
default:"75"
The quality of the output image (1-100). Higher values produce better quality but larger file sizes. Only applies to jpeg and webp formats.
boolean
default:"false"
When set to true, captures the entire scrollable area of the page instead of just the viewport.
boolean
default:"false"
When set to true, makes the background transparent for PNG format images.
number
default:"1920"
The width of the viewport in pixels.
number
default:"1080"
The height of the viewport in pixels.
number
default:"1"
Device scale factor (minimum: 1). Controls the resolution of the screenshot.
string
Predefined screen size preset to use instead of specifying width and height manually. Supported values include:
  • QVGA - 320×240
  • VGA - 640×480
  • SVGA - 800×600
  • HD - 1280×720
  • HD+ - 1600×900
  • SXGA - 1280×1024
  • FHD - 1920×1080
  • 2K - 2048×1080
  • 2K QHD - 2560×1440
  • 5K - 5120×2880
  • 4K UHD - 3840×2160
See the full list of screen size presets here
boolean
default:"false"
When set to true, emulates a mobile device viewport and takes the meta viewport tag into account.
boolean
default:"false"
When set to true, forces the page to render in dark mode using the CSS prefers-color-scheme media feature.
boolean
default:"false"
Enables WebGL, GPU acceleration, and other 3D APIs. Note: This option may impact performance and increase API latency.
object
Custom page-load behavior settings.
When set to true, displays header and footer in PDF output. Only applies when type is set to pdf.
boolean
default:"false"
When set to true, prints background graphics in PDF output. Only applies when type is set to pdf.
string
Page ranges to print in PDF format (e.g., ‘1-5, 8, 11-13’). Only applies when type is set to pdf.
string
default:"binary"
The specified return type for the response
  • url
  • base64
  • binary
string
required
Your JigsawStack API key

Response

The response format depends on the return_type parameter:

URL Response

return_type: “url” or “base64”
boolean
Indicates whether the call was successful.
object
Usage information for the API call.
string
A unique identifier for the request
string
The URL of the generated file (image or PDF) that can be accessed directly.

Binary Response

return_type: “binary” The API returns the generated file (image or PDF) directly in the response body as binary data.

Common Use Cases

Website Screenshots

Capture screenshots of websites for:
  • Monitoring and testing
  • Generating previews or thumbnails
  • Creating social media images
  • Archiving webpage states

HTML to Image Conversion

Convert HTML snippets to images for:
  • Email templates
  • Social media posts
  • Dynamic image generation
  • Creating graphics from templates

PDF Generation

Create PDFs from webpages for:
  • Generating reports
  • Creating downloadable content
  • Archiving articles or documentation
  • Creating printable versions of web content

Responsive Design Testing

Test how websites appear on different screen sizes:
  • Mobile vs. desktop views
  • Various device dimensions
  • Light vs. dark mode

Best Practices

  1. Optimal Quality Settings:
    • For lossless quality, use PNG format with quality: 100
    • For smaller file sizes with good quality, use WebP format with quality: 80-90
    • For the smallest file sizes (where quality is less critical), use JPEG format with quality: 70-80
  2. Page Loading:
    • Use wait_until: "networkidle0" for dynamic websites that load content via JavaScript
    • Set appropriate timeout values for websites that take longer to load
    • Consider using explicit width and height to match the content dimensions
  3. PDF Configuration:
    • Enable pdf_print_background when capturing colorful websites as PDFs
    • Use pdf_page_range to capture only specific pages for large websites
    • Set appropriate page dimensions with width and height for better PDF layout