Skip to content

Documentation for "execute" #5

Description

@jonlachlan

Hi,
It didn't take too long to figure this out, but it would be helpful to have an example of how to use the execute command. For example, pointing out that the args is an array of strings that should be ordered just like the pdftk CLI.
Example:

PDFTK.execute(["/path/to/in.pdf","commandToExecute"],function(err,stdout,stderr) {
 // stdout is a default output unless output file path is specified in args array
 // stdout is a Node Buffer (https://nodejs.org/api/buffer.html)
 console.log(stdout.toString('utf8'));
}

BTW the command I'll primarily be using is dump_data_fields which I will use to parse the field values of a PDF file. I'm parsing the values using the SO answers here: http://stackoverflow.com/questions/30362686/parsing-a-colon-separated-string-into-json-in-node-javascript. I'm storing PDFs using Collection FS using the filesystem storage option (cfs:filesystem). So far it works, so I'm super appreciative of this package. Thanks!!!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions