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)