Skip to content

Example code overwriting options parameter #17

@CMarker

Description

@CMarker

As currently written, the examples will have undesired behavior - ignoring the options object passed in.

For ex:

extract(filePath, { splitPages: false }, function (err, text) {
  if (err) {
    console.dir(err)
    return
  }
  console.dir(text)
})

Referencing code

module.exports = function pdfTextExtract (filePath, options, pdfToTextCommand, cb) {
if (typeof (pdfToTextCommand) === 'function') {
    cb = pdfToTextCommand
    pdfToTextCommand = 'pdftotext'
    options = {}
  }
}

Working example, not ignoring options parameter -

var path = require('path')
var filePath = path.join(__dirname, '/document.pdf')
var extract = require('pdf-text-extract')
extract(filePath, { splitPages: false }, 'pdftotext', function (err, text) {
    if (err) {
        console.dir(err)
        return
    }
    console.dir(text)
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions