Use Complete Page Capture - Screenshot & PDF with Python
Capture complete full-page screenshots or PDFs of any URL list. Scrolls lazy content, waits for images and fonts, removes fixed headers and consent overlays, emulates real devices, and reports blocks and truncation instead of returning a broken image.
1. Choose the data you need
Review the published README for supported collection modes, examples, and limits. The recipe below uses the current published input definition.
2. Prepare a source-based input
This JSON contains published prefills and required-field defaults. Review every value for your task before running it; it is not a promise of successful collection.
{
"colorScheme": "no-preference",
"delay": 0,
"delayAfterScrolling": 0,
"device": "custom",
"deviceScaleFactor": 1,
"format": "png",
"fullPage": true,
"hideFixedElements": false,
"locale": "en-US",
"maxConcurrency": 1,
"maxPageHeight": 0,
"maxRetries": 0,
"maxScrollSteps": 400,
"navigationTimeoutSecs": 60,
"pdfFitOnePage": false,
"pdfLandscape": false,
"pdfMargin": "none",
"pdfPageSize": "web",
"pdfPrintBackground": true,
"quality": 85,
"scrollStepPx": 250,
"scrollToBottom": false,
"urls": [
{
"url": "https://www.apify.com/"
}
],
"viewportHeight": 1080,
"viewportWidth": 1280,
"waitForFonts": true,
"waitForImages": false,
"waitUntil": "domcontentloaded",
"waitUntilNetworkIdleAfterScroll": false,
"waitUntilNetworkIdleAfterScrollTimeout": 1000
}
Download input.example.json and save your reviewed copy as input.json.
| Field | Type | Required | Description |
|---|---|---|---|
urls | array | required | Web pages to capture. Each item can be a URL object or a plain URL string. Bare domains such as example.com are accepted and use https. |
format | string | optional | PNG is lossless, JPEG and WebP are smaller, PDF produces a printable document. WebP conversion uses Pillow after the browser capture. |
quality | integer | optional | Quality for JPEG and WebP output (1-100). Ignored for PNG and PDF. |
fullPage | boolean | optional | Capture the full scrollable page. Turn off to capture only the visible viewport. A selector overrides this option. |
selector | string | optional | Optional CSS selector. When set, captures only that element and ignores fullPage. Example: main, #pricing, article. |
device | string | optional | Device preset. Custom uses the viewport width, height and scale factor below. Presets emulate a real mobile or desktop browser. |
viewportWidth | integer | optional | Browser viewport width in pixels when Device is Custom. |
viewportHeight | integer | optional | Browser viewport height in pixels when Device is Custom. |
deviceScaleFactor | integer | optional | Pixel density for Device=Custom: 1 is standard, 2 is retina, 3 is high-DPI mobile. Device presets use their own scale factor. |
colorScheme | string | optional | Request the site's light or dark theme through prefers-color-scheme where the site supports it. |
locale | string | optional | Locale used for navigator.language and localized pages. |
waitUntil | string | optional | Navigation readiness. DOM content loaded is the fastest reliable default; network idle can stall on analytics-heavy sites. |
waitForSelector | string | optional | Optional CSS selector to wait for before capture. Useful for single-page apps. Fails the URL if the element never becomes visible. |
waitForImages | boolean | optional | Wait up to 5 seconds for images to finish loading after scrolling. Incomplete images are reported in warnings. |
waitForFonts | boolean | optional | Wait up to 5 seconds for web fonts to finish loading. |
delay | integer | optional | Additional milliseconds to wait after navigation before scrolling or capturing. |
scrollToBottom | boolean | optional | Scroll through the page in steps to trigger lazy images, infinite-scroll widgets and content-visibility sections before capture. |
maxScrollSteps | integer | optional | Stop after this many scroll steps. Prevents infinite-scroll pages from running forever. A cap hit sets truncated=true in the record. |
scrollStepPx | integer | optional | Pixels to scroll per step. Smaller steps trigger more IntersectionObserver content but take longer. |
delayAfterScrolling | integer | optional | Milliseconds to wait after scrolling and before capture. Only used when scrolling is enabled. |
waitUntilNetworkIdleAfterScroll | boolean | optional | After scrolling, wait until the network is idle before capture. Uses the timeout below. |
waitUntilNetworkIdleAfterScrollTimeout | integer | optional | Maximum milliseconds to wait for network idle after scrolling. |
hideFixedElements | boolean | optional | Hide real fixed headers, full-screen overlays and chat widgets before capture. Sticky content blocks are left in place. Default off because resetting to the top already prevents repeated headers on most pages. |
cookieBannerAction | string | optional | Hide common cookie and consent overlays, click Accept first, or leave them untouched. |
selectorsToHide | string | optional | Comma or newline separated CSS selectors for extra elements to hide before capture. Example: .newsletter-popup, #chat-widget |
pdfPageSize | string | optional | Paper size for PDF output. Web page width preserves the previous 1280 px wide / Letter-height behavior. |
pdfLandscape | boolean | optional | Use landscape orientation for PDF pages. |
pdfPrintBackground | boolean | optional | Include CSS backgrounds, colors and images in the PDF. |
pdfFitOnePage | boolean | optional | Create one tall PDF page instead of paginated paper. Overrides the paper height but keeps the selected margins. |
pdfMargin | string | optional | Page margins for PDF output. |
maxConcurrency | integer | optional | How many URLs to capture in parallel. Keep at 1 for long pages at 2048 MB; higher values need more memory. |
maxRetries | integer | optional | Retry transient navigation failures and block pages. Retries use the AUTO datacenter proxy when no user proxy is configured. |
navigationTimeoutSecs | integer | optional | Maximum seconds to wait for navigation and selector readiness per URL. |
maxPageHeight | integer | optional | Clip full-page images at this CSS height. 0 means unlimited. PDFs keep their full document height and ignore this limit. Truncation is reported in the record. |
proxyConfiguration | object | optional | Optional proxy override. The actor starts direct and uses an Apify AUTO datacenter proxy only after a real block when this is empty. Residential is never selected automatically. |
3. Start an Actor run
Set APIFY_TOKEN in your environment. Python 3.10 or newer is sufficient; this recipe uses no third-party packages.
Execution may incur charges. Review current pricing on Apify. The request asks for a 120-second timeout and a charge limit; these settings are subject to Apify’s pricing and do not guarantee an all-inclusive spending cap.
import json
import os
import urllib.request
# Save the schema-derived example as input.json; review and edit it first.
with open("input.json", encoding="utf-8") as stream:
actor_input = json.load(stream)
token = os.environ["APIFY_TOKEN"]
request = urllib.request.Request(
"https://api.apify.com/v2/acts/oG0Mque4wwAd1e4EK/runs?timeout=120&maxTotalChargeUsd=0.50",
data=json.dumps(actor_input).encode("utf-8"),
headers={"Authorization": "Bearer " + token, "Content-Type": "application/json"},
method="POST",
)
# This starts a potentially billable run. Do not automatically retry this POST.
with urllib.request.urlopen(request, timeout=40) as response:
run = json.load(response)["data"]
print("Run ID:", run["id"])
print("Status:", run["status"])
# Inspect and download results in Apify Console once the run succeeds.
4. Inspect the actual results
Open the run in Apify Console and wait for a successful completion. Use the published output schema to locate results and the dataset schema to understand declared views. Missing or optional record fields must not be treated as guaranteed values.
One record per captured URL, with the file link, page metadata, block/error classification and capture evidence.
Questions before you run
Which inputs are required?
The published required fields are urls
What does this guide verify?
The fields, prefills, and schema links are rendered from the published build. This is a usage recipe, not a paid live extraction test. Source availability and collection results can vary.
What if the run request times out?
Check Apify Console before retrying. The first request may already have created a run. Do not automatically repeat a run-creation POST.
Generated from source build ugu5kWKeaoli71PqF and its README and schemas. Source changes regenerate this guide; no third-party editorial claims are inferred.