Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browser-based-export

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-based-export

Wrapper on top of Puppeteer's export to PDF feature

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

npm version build status

Goal

browser-based-export is a wrapper on top of Puppeteer's export to PDF feature.

It can handle authentication by injecting cookies or Web Storage items into Headless Chromium. It also generates better looking PDF than Puppeteer by resizing the browser page to the paper format before triggering the PDF export.

The library is also available as a server and an AWS Lambda.

Export isolation

Every export happens in an isolated incognito Chromium context. It means that the cookies, Web Storage items or any sensitive information will not be shared across exports. Even if they are launched in parallel.

Usage

Example

const {inBrowser} = require('browser-based-export');

// Start Headless Chromium and automatically close it when the passed callback resolves.
inBrowser({
  action: ({exportPdf}) =>
    exportPdf({
      payload: {
        url: 'https://example.com',
      },
      timeoutInSeconds: 10,
    }).then(pdfBuffer => {
      // Do something with it.
    }),
});

Take a look at:

Troubleshooting

This package is using the debug utility. Set the DEBUG environment variable to browser-based-export:* to see the debug messages.

If that's not enough, you can follow the Puppeteer debugging tips.

Keywords

FAQs

Package last updated on 25 May 2018

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