~/utility/web-printer
Universal Web Printer — URL & HTML to PDF, Image
Convert any URL or HTML to PDF, PNG, JPEG, or WebP with smart scroll-stitch, element extraction, PDF encryption, and watermarking.
media
TypeScriptPlaywrightPDF-libSharp
Global
categoryutility / media
languageTypeScript
stackTypeScript, Playwright, PDF-lib, Sharp
marketsGlobal
outputclean, RAG-ready JSON
key features
Multi-format output — PDF, PNG, JPEG, WebP
Multiple view modes — viewport, full-page, CSS selector, readability
Smart scroll-stitch for accurate full-page captures
Element-level extraction via CSS selectors
Page manipulation — remove elements, click buttons, inject CSS, hide fixed headers
PDF encryption (RC4 128-bit) and watermarking
PDF merging for multi-page documents
Custom viewport and scale factor configuration
use cases
- Automated report generation from web dashboards
- Website archival and documentation
- Visual regression testing snapshots
- E-commerce product page screenshots for catalogs
- Legal compliance — capturing web content as evidence
- Generating PDFs from web applications
input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sourceType | string | optional | url (default) or html — render startUrls or htmlContent |
startUrls | array | optional | URLs to render |
htmlContent | string | optional | Raw HTML to render |
outputFormat | string | optional | pdf, png, jpeg, or webp (default: pdf) |
viewMode | string | optional | viewport, fullPage, selector, or readability |
targetSelector | string | optional | CSS selector for element-level capture |
viewportWidth | number | optional | Browser viewport width (default: 1280) |
viewportHeight | number | optional | Browser viewport height (default: 720) |
scaleFactor | number | optional | Device scale factor for sharper screenshots (default: 2) |
removeSelectors | array | optional | CSS selectors of elements to remove before capture |
clickSelectors | array | optional | CSS selectors to click before capture, e.g. Load More buttons |
hideFixedElements | boolean | optional | Hide fixed/sticky elements such as navbars during capture (default: true) |
customCss | string | optional | Custom CSS injected before rendering |
pdfPassword | string | optional | Encrypt PDF with RC4 128-bit encryption |
mergePdfs | boolean | optional | Merge all generated PDFs into a single file |
watermark | object | optional | Text or image watermark added to output files |
Output Example
The tool generates files in your chosen format (PDF, PNG, JPEG, or WebP) and stores them in the Apify dataset. Each output includes metadata:
1{
2 "url": "https://example.com",
3 "sourceType": "url",
4 "outputFormat": "pdf",
5 "viewMode": "full-page",
6 "fileName": "example_com_2025-12-11T16-06-29-849Z.pdf",
7 "fileUrl": "https://api.apify.com/v2/key-value-stores/abc123DEF456ghi78/records/example_com_2025-12-11T16-06-29-849Z.pdf",
8 "fileSize": 41613,
9 "pageCount": 1,
10 "capturedAt": "2025-12-11T16:06:29.852Z"
11}
faq
Can I capture just a specific element on the page?
Yes, use the targetSelector parameter with a CSS selector to capture only a specific element. For example, use '#main-content' to capture just the main content area.
How does smart scroll-stitch work?
For full-page captures, the tool scrolls the page in increments, capturing each viewport slice, then stitches them together. This ensures lazy-loaded content and animations are properly captured.
Can I remove cookie banners or ads before capture?
Yes, use removeSelectors to specify CSS selectors of elements to remove. You can also use hideFixedElements to hide sticky headers and floating elements.