Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
A lightweight, highly efficient, and customizable Node.js library for crawling websites and converting pages into compact, AI-optimized PDFs. Ideal for data archiving, offline analysis, and feeding content to AI tools. Delivers fast performance and allows
A tiny, fast, and customizable Node.js library to crawl websites and save all pages as compact, AI-ready PDFs. Use it from the command line or as a module in your Node.js scripts. Perfect for data archiving, offline analysis, and feeding content to AI tools.
Star this repository and share it with your friends.
Install using pnpm, npm, or yarn
pnpm add e2pdf
or
npm install e2pdf
or
yarn add e2pdf
To use e2pdf from the command line:
e2pdf <website-url>
For example:
e2pdf https://example.com
This will crawl the website and save all pages as PDFs in the current directory.
Here’s an example of using e2pdf in a Node.js script:
import e2pdf from "e2pdf";
(async () => {
await e2pdf("https://example.com", {
out: "./pdfs",
pdf: {
format: "A4",
printBackground: true,
margin: { top: "20px", bottom: "20px" },
},
crawlerOptions: { maxRequestsPerCrawl: 100 },
});
console.log("Crawling completed! PDFs saved to ./pdfs");
})();
The e2pdf
function accepts two arguments:
out
string
process.cwd()
pdf
PDF generation options (compatible with Playwright’s PDF options):
displayHeaderFooter
: Display header and footer. Defaults to false
.footerTemplate
: HTML template for the footer.format
: Paper format (e.g., A4
, Letter
). Defaults to Letter
.headerTemplate
: HTML template for the header.landscape
: Paper orientation. Defaults to false
.margin
: Margins for the PDF (top
, right
, bottom
, left
).printBackground
: Print background graphics. Defaults to false
.crawlerOptions
Options for the Crawlee PlaywrightCrawler.
crawlerConfig
Configuration for Crawlee’s Configuration object.
We welcome contributions! Please fork the repository and submit a pull request.
This library is licensed under the MPL-2.0 open-source license.
If you encounter any issues or have suggestions, please open an issue or contact us. We’d love to hear from you!
Please enroll in our courses or sponsor our work.
with 💖 by Mayank Kumar Chaudhari
FAQs
A lightweight, highly efficient, and customizable Node.js library for crawling websites and converting pages into compact, AI-optimized PDFs. Ideal for data archiving, offline analysis, and feeding content to AI tools. Delivers fast performance and allows
The npm package e2pdf receives a total of 37 weekly downloads. As such, e2pdf popularity was classified as not popular.
We found that e2pdf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.