HTML To Any
Capture screenshots of a website, convert HTML to both image and PDF formats.
Request Parameters
Body
The HTML content to convert to image or PDF. Either html
or url
is
required, but not both.
The URL of the webpage to capture. Either html
or url
is required, but not
both.
The output file format. Supported formats:
png
- PNG image formatjpeg
- JPEG image formatwebp
- WebP image formatpdf
- PDF document
The quality of the output image (1-100). Higher values produce better quality but larger file sizes. Only applies to jpeg and webp formats.
When set to true, captures the entire scrollable area of the page instead of just the viewport.
When set to true, makes the background transparent for PNG format images.
The width of the viewport in pixels.
The height of the viewport in pixels.
Device scale factor (minimum: 1). Controls the resolution of the screenshot.
Predefined screen size preset to use instead of specifying width and height manually. Supported values include:
QVGA
- 320×240VGA
- 640×480SVGA
- 800×600HD
- 1280×720HD+
- 1600×900SXGA
- 1280×1024FHD
- 1920×10802K
- 2048×10802K QHD
- 2560×14405K
- 5120×28804K UHD
- 3840×2160
See the full list of screen size presets here
When set to true, emulates a mobile device viewport and takes the meta viewport tag into account.
When set to true, forces the page to render in dark mode using the CSS prefers-color-scheme media feature.
Enables WebGL, GPU acceleration, and other 3D APIs. Note: This option may impact performance and increase API latency.
Custom page-load behavior settings.
When set to true, displays header and footer in PDF output. Only applies when
type
is set to pdf
.
When set to true, prints background graphics in PDF output. Only applies when
type
is set to pdf
.
Page ranges to print in PDF format (e.g., ‘1-5, 8, 11-13’). Only applies when
type
is set to pdf
.
Header
Your JigsawStack API key
Response
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
-
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
- For lossless quality, use PNG format with
-
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
andheight
to match the content dimensions
- Use
-
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
andheight
for better PDF layout
- Enable