🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

epdf

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epdf

Render any URL to PDF using Electron

0.1.3
latest
npm
Version published
Maintainers
1
Created
Source

Description

Uses Electron to render any webpage (by URL) to a PDF. Works for websites rendered in the browser with JavaScript.

Installation and Usage

Get with NPM:

# local for one project
npm install --save-exact epdf

# global for CLI
npm install --global epdf

Epdf can be used as a Node.js library or from the command line.

Programmatic API

const {render} = require('epdf')

render({url: 'https://my-awesome-website' /* other settings */})
  .then(buffer => {
    // buffer contains rendered PDF in binary form
  })
  .catch(error => {
    // ...
  })

render takes the same args as the CLI. To see the available settings, run $(npm bin)/epdf --help (for local install) or epdf --help (for global install).

The value returned by render can be used as a promise, but is actually a Future from the Posterus library. You can stop it by calling .deinit(), which immediately closes the Electron process.

const {render} = require('epdf')

const future = render(settings)
  .mapResult(buffer => {})
  .mapError(error => {})

// Stops the whole thing
future.deinit()

CLI

# for global install
epdf

# for local install
$(npm bin)/epdf

# get help
epdf --help

# to stdout
epdf --url <some-url>

# to file
epdf --url <some-url> --out <some-file>

Keywords

pdf

FAQs

Package last updated on 20 Dec 2017

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