Web-to-PDF/PNG conversion done right
Convert any web page to pixel-perfect PDFs or high-quality screenshots with a single command.
Quick Start • CLI Usage • Library API • Configuration • Contributing
- 🚀 Zero Config — Works out of the box with sensible defaults
- 📄 PDF & PNG — Auto-detects format from file extension
- 📱 Device Emulation — Mobile, tablet, and custom viewports
- 🔄 Full Page Capture — Scroll and capture entire pages with lazy-loaded content
- ⚡ Batch Processing — Convert hundreds of URLs with concurrency control
- 🔐 Authentication — Basic auth, cookies, and custom headers
- 🩺 Built-in Diagnostics —
printeer doctorchecks your environment - 📦 Dual Use — CLI tool and Node.js library
# npm
npm install -g printeer
# bun
bun add -g printeer
# yarn
yarn global add printeer# Convert webpage to PDF
printeer convert https://example.com page.pdf
# Screenshot in mobile view
printeer convert https://example.com mobile.png --mobile --full-page
# Check your environment
printeer doctor# URL → PDF (auto-detected from extension)
printeer convert https://example.com output.pdf
# URL → PNG screenshot
printeer convert https://example.com screenshot.png
# Full page screenshot with mobile emulation
printeer convert https://example.com mobile.png --mobile --full-page# Mobile (iPhone-like: 375×812, 2x scale, touch enabled)
printeer convert https://example.com mobile.png --mobile --full-page
# Tablet (iPad-like: 768×1024, 2x scale, touch enabled)
printeer convert https://example.com tablet.png --tablet --full-page
# Custom viewport
printeer convert https://example.com custom.png --viewport 1440x900# A4 landscape with background graphics
printeer convert https://example.com report.pdf \
--format A4 \
--orientation landscape \
--print-background
# Custom margins
printeer convert https://example.com document.pdf --margins "1in"# Wait for specific element
printeer convert https://spa-app.com dashboard.pdf \
--wait-selector "#chart-loaded"
# Wait for network idle
printeer convert https://example.com page.pdf --wait-until networkidle0# Process multiple URLs from a file
printeer batch jobs.json --concurrency 5 --continue-on-errorjobs.json:
[
{ "url": "https://example.com", "output": "example.pdf" },
{ "url": "https://google.com", "output": "google.pdf" }
]# Check browser, fonts, and environment
printeer doctor
# Verbose output
printeer doctor --verbosenpm install printeerimport printeer from 'printeer';
// Simple conversion
await printeer('https://example.com', 'output.pdf');
// With options
await printeer('https://example.com', 'screenshot.png', null, {
viewport: { width: 1920, height: 1080 },
fullPage: true
});import printeer from 'printeer';
await printeer('https://example.com', 'report.pdf', null, {
format: 'A4',
printBackground: true,
margin: { top: '1in', bottom: '1in' },
waitUntil: 'networkidle0'
});import { DefaultBrowserManager } from 'printeer';
const browserManager = new DefaultBrowserManager({
headless: true,
args: ['--no-sandbox']
});
await browserManager.initialize();
const browser = await browserManager.getBrowser();
// Use browser...
await browserManager.cleanup();Printeer supports configuration files for complex setups:
.printeerrc.json:
{
"page": {
"format": "A4",
"orientation": "portrait"
},
"viewport": {
"width": 1920,
"height": 1080
},
"wait": {
"until": "networkidle0",
"timeout": 30000
}
}| Variable | Description |
|---|---|
PRINTEER_BROWSER_EXECUTABLE_PATH |
Custom Chrome/Chromium path |
PRINTEER_BROWSER_HEADLESS |
true / false |
PRINTEER_LOG_LEVEL |
error, warn, info, debug |
Printeer is built for Node.js but works across modern JavaScript runtimes:
| Runtime | Status | Notes |
|---|---|---|
| Node.js 16.8+ | ✅ Full Support | Primary runtime, fully tested |
| Bun 1.0+ | ✅ Supported | Install via bun add printeer |
| Deno 2.0+ | Use npm specifier (see below) |
npm install -g printeer# Install
bun add printeer
# Note: Run post-install to download Chromium
bunx puppeteer browsers install chrome
# Use
bun run printeer convert https://example.com page.pdf// Import using npm specifier
import printeer from "npm:printeer";
// Requires permissions: --allow-read --allow-write --allow-net --allow-run --allow-env
await printeer("https://example.com", "output.pdf");Run with:
deno run --allow-all your-script.ts- Chromium — Auto-installed with Puppeteer, or set
PRINTEER_BROWSER_EXECUTABLE_PATH - Linux headless servers — May require
xvfbor--no-sandboxflag
Run the built-in diagnostic tool:
printeer doctor --verboseThis checks:
- ✅ Node.js version
- ✅ Chromium installation
- ✅ Display server (for headless environments)
- ✅ Font availability
- ✅ Sandbox configuration
Contributions are welcome! Please read our contributing guidelines before submitting a PR.
# Clone the repository
git clone https://github.com/maniartech/printeer.git
cd printeer
# Install dependencies
npm install
# Build
node scripts/build.js
# Run tests
npm test
# Run the CLI in development
node scripts/run-cli.js convert https://example.com test.pdfDocumentation • Changelog • Issues
Made with ❤️ by ManiarTech