Html To Png Actor avatar
Html To Png Actor

Pricing

$25.00 / 1,000 results

Go to Store
Html To Png Actor

Html To Png Actor

Developed by

Mohammed Rhamnia

Maintained by Community

Captures PNG screenshots of webpages and converts HTML to PNG

0.0 (0)

Pricing

$25.00 / 1,000 results

1

Monthly users

3

Runs succeeded

>99%

Last modified

2 months ago

Automated HTML to PNG Screenshot Generator

Overview

This Apify Actor captures PNG screenshots of webpages and converts HTML to PNG with configurable options, including custom window size settings.

Features

  • Supports capturing a single URL.
  • Configurable browser window size.
  • Stores screenshots in Apify Key-Value Store.
  • Automatically deletes old screenshots after 7 days.

Input Configuration

The Actor accepts the following input parameters:

1{
2  "url": "https://apify.com",
3  "width": 1280,
4  "height": 720
5}

Parameters

  • url (string) - The URL of the webpage to capture.
  • width (integer, optional) - Defines the browser viewport width size. Default: 1280 pixels.
  • height (integer, optional) - Defines the browser viewport height size. Default: 720 pixels.

Usage Example

Using the Apify Python Client to run the Actor and retrieve screenshots:

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your API token
4client = ApifyClient("your_apify_api_token")
5
6# Prepare the Actor input
7run_input = {
8    "url": "https://example.com",
9    "width": 1024,
10    "height": 768,
11}
12
13# Run the Actor and wait for it to finish
14run = client.actor("your_actor_id").call(run_input=run_input)
15store_client = client.key_value_store(run['defaultKeyValueStoreId'])
16
17# Retrieve and save screenshot
18screenshot_key = f"screenshot-{int(time.time())}-{run_input['url'].replace('https://', '').replace('http://', '').replace('/', '_')}.png"
19record = store_client.get_record_as_bytes(screenshot_key)
20if record is not None and 'value' in record:
21    with open(screenshot_key, "wb") as f:
22        f.write(record['value'])
23    print(f"Saved {screenshot_key}")
24else:
25    print(f"No record found for key: {screenshot_key}")

Output

The Actor generates a PNG screenshot and stores it in the Key-Value Store.

License

This project is protected under a closed-source license. Unauthorized use, distribution, modification, or replication is strictly prohibited without prior written permission from the creator. Contact the project owner for licensing inquiries.

Pricing

Pricing model

Pay per result 

This Actor is paid per result. You are not charged for the Apify platform usage, but only a fixed price for each dataset of 1,000 items in the Actor outputs.

Price per 1,000 items

$25.00