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 - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

lib/pdf.js

6

lib/index.js

@@ -7,5 +7,5 @@ "use strict";

var _webpack = require("pdfjs-dist/webpack");
var _pdf = require("./pdf");
var _webpack2 = _interopRequireDefault(_webpack);
var _pdf2 = _interopRequireDefault(_pdf);

@@ -21,3 +21,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var url = URL.createObjectURL(pdfBlob);
var pdf = await _webpack2.default.getDocument(url).promise;
var pdf = await _pdf2.default.getDocument(url).promise;
URL.revokeObjectURL(url);

@@ -24,0 +24,0 @@ var page = await pdf.getPage(1);

{
"name": "@doctolib/pdf-to-png",
"version": "0.1.1",
"version": "0.2.0",
"description": "Browser-side PDF to PNG conversion",

@@ -14,3 +14,5 @@ "license": "MIT",

"babel": {
"presets": ["es2015"]
"presets": [
"es2015"
]
},

@@ -17,0 +19,0 @@ "devDependencies": {

# Browser-side PDF to PNG conversion
## Setup
Configure the worker by adding this to your Webpack configuration:
```js
// 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](https://github.com/webpack-contrib/worker-loader#cross-origin-policy).
## Usage

@@ -21,3 +40,3 @@

Will only work within the context of a webpack-based project for now due to the hardcoded dependency to the webpack-configured version of PDF.js
Implicit dependency to Webpack at the moment, due to the way workers are handled.

@@ -31,2 +50,3 @@ ## Development

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

@@ -33,0 +53,0 @@ git push origin <version>

@@ -1,2 +0,2 @@

import pdfjs from "pdfjs-dist/webpack";
import pdfjs from "./pdf";

@@ -3,0 +3,0 @@ // Inspired by https://stackoverflow.com/questions/12921052/parsing-pdf-pages-as-javascript-images

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