New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bits-to-dead-trees

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bits-to-dead-trees

Turn HTML into PDF files

  • 0.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
87
increased by569.23%
Maintainers
1
Weekly downloads
 
Created
Source

bits-to-dead-trees

🖥 -> 🌲 -> 📄 -> 🖨

Exposes a web server with a single endpoint to take in a URL and create a PDF out of that. It's using Playwright in the background for this.

Setup

Requirements

  1. Node 16+
  2. npm

Installation

  1. git checkout https://github.com/rmehner/bits-to-dead-trees
  2. cd bits-to-dead-trees
  3. npm install
  4. npm run build to build the app
  5. npm start to start the server. It'll listen to port 8000 on localhost by default.

Development

  • After updating the playwright dependency, you should run npm run update-schemas to make sure that the server knows about new PDF options
  • Use npm run start:dev to start everything in dev mode with build watch and friends

Server

The server exposes the /pdf endpoint that listens to a POST request and expects a JSON body:

{
  "url": "https://your-target-url.com/site/you/want/a/pdf/of",
  "options": {}
}

options are the options Playwright knows about PDF: https://playwright.dev/docs/api/class-page#page-pdf. We pass them to Playwright directly, so please refer to their docs.

The response is the PDF file.

Keywords

FAQs

Package last updated on 11 Apr 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc