@doctolib/pdf-to-png
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5021
7
73
55
0