From a97b4b714252ec2e2533a7dca5b1f5859cbc181a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=BA=E9=96=93=E5=A4=B1=E6=A0=BC?= Date: Wed, 11 Oct 2017 12:24:18 +0800 Subject: [PATCH] adding readme --- package.json | 2 -- readme.md | 23 +++++++++++++++++++++++ src/index.js | 6 ++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 readme.md diff --git a/package.json b/package.json index 00cbaa1..c1dc577 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,6 @@ "author": "Jacob Baring ", "dependencies": { "bluebird": "^3.5.1", - "co": "^4.6.0", - "dotenv": "^4.0.0", "fs-extra": "^4.0.2", "gm": "^1.23.0" }, diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..fc7e88f --- /dev/null +++ b/readme.md @@ -0,0 +1,23 @@ +# PDF2Pic + +Node module for converting PDF to image based on pdf2img by Fitra Adity + +## Usage + +```javascript +let PDF2Pic = require('pdf2pic') +let converter = new PDF2Pic({ + density: 100, + savename: "untitled", + savedir: "./images" +}) + +converter.convert("/path/to/pdf/sample.pdf") + .then(resolve => { + console.log("image converted successfully") + }) +``` + +___ + +This module is based on Fitra Adity's Great work. \ No newline at end of file diff --git a/src/index.js b/src/index.js index bcd328d..ecf3018 100644 --- a/src/index.js +++ b/src/index.js @@ -75,6 +75,12 @@ class PDF2IMG { } + /** + * Intialize converter + * @param {String} pdf_path path to file + * @param {Page} page page number to be converted (-1 for all pages) + * @return {Object} image status + */ async convert(pdf_path, page = 1) { this.isValidPDF(pdf_path) this.fileExists(pdf_path)