pdf-my-url
v1.0.0
Published
A CLI tool to create PDFs from web pages
Downloads
77
Readme
pdf-my-url
A command-line utility to create PDFs from web pages using Puppeteer.
Installation
You can run this utility directly using npx
:
npx pdf-my-url --url <webpage-url> --output <pdf-path>
Example
npx pdf-my-url --url https://www.google.com --output ./google.pdf
Features
- Captures full-page screenshots
- Automatically adjusts height to capture entire page content
- Maintains high-quality output with proper scaling
- Supports custom viewport width
- Includes background colors and images in the PDF
Technical Details
The utility uses Puppeteer to launch a headless Chrome browser, navigate to the specified URL, and generate a PDF. It automatically:
- Sets the initial viewport
- Waits for the page to load completely
- Calculates the full height of the page
- Adjusts the viewport to match the content
- Generates a high-quality PDF with background elements