{
  "name": "pdf2png-mp",
  "version": "0.5.4",
  "description": "Convert PDF-document to PNG-images",
  "engine": "node >= 0.6.0",
  "main": "./lib/pdf2png.js",
  "dependencies": {
    "filesource": "latest",
    "pdf_page_count": "^1.0.10",
    "tmp": "0.0.23"
  },
  "repository": {
    "type": "git",
    "url": "git@github.com:Inkognitoo/Pdf2Png.git"
  },
  "homepage": "https://github.com/Inkognitoo/Pdf2Png",
  "bugs": {
    "url": "https://github.com/Inkognitoo/Pdf2Png/issues"
  },
  "dist": {
    "shasum": "9917d09667f6885e0aad2d7d88ddef89d3843d8b",
    "tarball": "http://registry.npmjs.org/pdf2png/-/pdf2png-1.0.5.tgz"
  },
  "_from": "pdf2png-mp@",
  "_npmVersion": "1.4.3",
  "_npmUser": {
    "name": "inkognitoo",
    "email": "inkognitoo92@yandex.ru"
  },
  "maintainers": [
    {
      "name": "inkognitoo",
      "email": "inkognitoo92@yandex.ru"
    }
  ],
  "directories": {
    "test": "test"
  },
  "_shasum": "4632dde87b3a09b67a32bbac00edb538729a1212",
  "_resolved": "https://registry.npmjs.org/pdf2png/-/pdf2png-1.0.5.tgz",
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "convert",
    "pdf",
    "to",
    "png",
    "image",
    "images"
  ],
  "author": {
    "name": "inkognitoo"
  },
  "readme": "pdf2png-mp\r\n============\r\n\r\nInstall:\r\nnpm install pdf2png-mp\r\n\r\nThis is fork [another project](https://github.com/thnew/Pdf2Png), that can convert many-page .pdf file. \r\n\r\nThis project uses ghostscript, but there's no need to install it (if you use windows).\r\nIf you want the module to use a local installation of ghostscript, set the option useLocalGhostscript true.\r\n\r\nTested on Windows/Tested on AZURE    \r\nTested Ubuntu 14.04\r\n\r\nIf you want to use it with linux, you may replace the ghostscript-executable with something that works with linux.\r\nOr you install ghostscript for linux.\r\n[http://www.ghostscript.com/](http://www.ghostscript.com/)\r\n\r\n\r\nhere some examples how to use:\r\n\r\n```javascript\r\nvar pdf2png = require('pdf2png-mp');\r\n\r\n// Many page example\r\npdf2png.convert(\"./example.pdf\", { quality: 300 }, function(resp){\r\n    if(!resp.success)\r\n    {\r\n        console.log(\"Something went wrong: \" + resp.error);\r\n\r\n        return;\r\n    }\r\n\r\n    console.log(\"Yayy the pdf got converted, now I'm gonna save it!\");\r\n\r\n    var fs = require('fs');\r\n\r\n    resp.data.forEach(function(item, index) {\r\n\r\n        fs.writeFile(\"./example_simple\"+index+\".png\", item, function (err) {\r\n            if (err) {\r\n                console.log(err);\r\n            }\r\n            else {\r\n                console.log(\"The file \"+index+\" was saved!\");\r\n            }\r\n        });\r\n    });\r\n});\r\n\r\n// Most simple example\r\npdf2png.convert(__dirname + \"/example.pdf\", function(resp){\r\n\tif(!resp.success)\r\n\t{\r\n\t\tconsole.log(\"Something went wrong: \" + resp.error);\r\n\t\t\r\n\t\treturn;\r\n\t}\r\n\t\r\n\tconsole.log(\"Yayy the pdf got converted, now I'm gonna save it!\");\r\n\t\r\n\tfs.writeFile(\"test/example_simple.png\", resp.data, function(err) {\r\n\t\tif(err) {\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconsole.log(\"The file was saved!\");\r\n\t\t}\r\n\t});\r\n});\r\n\r\n// Example that returns a path\r\npdf2png.convert(__dirname + \"/example.pdf\", { returnFilePath: true }, function(resp){\r\n\tif(!resp.success)\r\n\t{\r\n\t\tconsole.log(\"Something went wrong: \" + resp.error);\r\n\t\t\r\n\t\treturn;\r\n\t}\r\n\t\r\n\tconsole.log(\"Yayy the pdf got converted, now I'm gonna save it!\");\r\n\t\r\n\tvar img = fs.readFileSync(resp.data);\r\n\t\r\n\tfs.writeFile(\"test/example_that_returns_a_path.png\", img, function(err) {\r\n\t\tif(err) {\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconsole.log(\"The file was saved!\");\r\n\t\t}\r\n\t}); \r\n});\r\n\r\n// Example with lower quality\r\npdf2png.convert(__dirname + \"/example.pdf\", { quality: 50 }, function(resp){\r\n\tif(!resp.success)\r\n\t{\r\n\t\tconsole.log(\"Something went wrong: \" + resp.error);\r\n\t\t\r\n\t\treturn;\r\n\t}\r\n\t\r\n\tconsole.log(\"Yayy the pdf got converted, now I'm gonna save it!\");\r\n\t\r\n\tfs.writeFile(\"test/example_with_lower_quality.png\", resp.data, function(err) {\r\n\t\tif(err) {\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconsole.log(\"The file was saved!\");\r\n\t\t}\r\n\t}); \r\n});\r\n\r\n// Example with higher quality\r\npdf2png.convert(__dirname + \"/example.pdf\", { quality: 200 }, function(resp){\r\n\tif(!resp.success)\r\n\t{\r\n\t\tconsole.log(\"Something went wrong: \" + resp.error);\r\n\t\t\r\n\t\treturn;\r\n\t}\r\n\t\r\n\tconsole.log(\"Yayy the pdf got converted, now I'm gonna save it!\");\r\n\t\r\n\tfs.writeFile(\"test/example_with_higher_quality.png\", resp.data, function(err) {\r\n\t\tif(err) {\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconsole.log(\"The file was saved!\");\r\n\t\t}\r\n\t}); \r\n});\r\n\r\n// Example using a local ghostscript installation\r\npdf2png.convert(__dirname + \"/example.pdf\", { useLocalGhostscript: true }, function(resp){\r\n\tif(!resp.success)\r\n\t{\r\n\t\tconsole.log(\"Something went wrong: \" + resp.error);\r\n\t\t\r\n\t\treturn;\r\n\t}\r\n\t\r\n\tconsole.log(\"Yayy the pdf got converted, now I'm gonna save it!\");\r\n\t\r\n\tfs.writeFile(\"test/example_simple.png\", resp.data, function(err) {\r\n\t\tif(err) {\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconsole.log(\"The file was saved!\");\r\n\t\t}\r\n\t}); \r\n});\r\n```\r\n\r\nIf an error like this appears:\r\nSomething went wrong: Error converting pdf to png: Error: Command failed: 'gs' is not recognized as an internal or external command, operable program or batch file.\r\n\r\nMaybe you have the node file you execute in a subfolder and Pdf2Png doesn't set  the path to ghostscript correctly anymore.\r\nYou can rewrite the path to the executable by setting \"pdf2png.ghostscriptPath\".\r\nLook at the following example of a script, being in the subfolder /lib.\r\nIt first detects the project-root folder and then builds the absolute path to the ghostscript folder.\r\n\r\n```javascript\r\nvar projectPath = __dirname.split(\"\\\\\");\r\nprojectPath.pop();\r\nprojectPath = projectPath.join(\"\\\\\");\r\n\r\nvar gsPath = projectPath + \"\\\\executables\\\\ghostScript\";\r\n\r\n// Rewrite the ghostscript path\r\npdf2png.ghostscriptPath = gsPath;\r\n```\r\n\r\nOptions:\r\nbool useLocalGhostscript\r\n\tIf true, the moudle won't set an envirponment attribute to the ghostscript executable.\r\n\tSet this true if you want to use an own local ghostscript installation\r\n\r\nbool returnFilePath\r\n\tIf you set this true, the module won't return you file-data, it will return you a path to a temporary file instead, containing the image.\r\n\tDon't forget to remove this temporary file.\r\n\r\nint quality [ = 100]\r\n\tThe quality of the PNG\r\n\tCan be higher and lower, play with it",
  "readmeFilename": "README.md",
  "_id": "pdf2png-mp@0.5.3"
}
