code: function(pages, callback) {
        // Use eachSeries to make sure that conversion has done page by page
        async.eachSeries(pages, function(page, callbackmap) {
          var inputStream = fs.createReadStream(input);
          var outputFile = options.outputdir + options.outputname + '_' + page + '.' + options.type;
  
          convertPdf2Img(inputStream, outputFile, parseInt(page), function(error, result) {
            if (error) {
              return callbackmap(error);
            }
  
            stdout.push(result);
            return callbackmap(error, result);
          });
        }, function(e) {
          if (e) callback(e);
  
          return callback(null, {
            result: 'success',
            message: stdout
          });
        });
      }
docs: Convert pdf file