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

@doctolib/pdf-to-png

Package Overview
Dependencies
Maintainers
6
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doctolib/pdf-to-png

Browser-side PDF to PNG conversion

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
6
Weekly downloads
 
Created
Source

Browser-side PDF to PNG conversion

Setup

Configure the worker by adding this to your Webpack configuration:

// webpack.config.js
{
  module: {
    rules: [
      {
        test: /pdf\.worker\.js$/,
        use: { loader: 'worker-loader', options: { inline: true } }
      }
    ]
  }
}

The inline option is not strictly necessary per se but highly advised to play well with Cross-Origin Policy.

Usage

import pdfToPng from "pdf-to-png";

// [...]

const pngBlob = await pdfToPng(pdfBlob);

Take a Blob as its unique mandatory argument and returns another Blob.

Most of the time, the entry will be a very specific type of Blob, the File.

See here for a simple and self-contained implementation example (in a React context).

Caveats

Implicit dependency to Webpack at the moment, due to the way workers are handled.

Development

Release

yarn prepublish
git add lib/ && git commit -m "<version>"
git push origin master
git tag <version>
git push origin <version>

Process inspired by this comment.

FAQs

Package last updated on 30 Jan 2020

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