tcr / scissors

PDF manipulation in Node.js! Split, join, crop, read, extract, boil, mash, stick them in a stew.
Apache License 2.0
285 stars 45 forks source link

Length of a PDF #7

Closed sjorssnoeren closed 7 years ago

sjorssnoeren commented 9 years ago

Hi,

Is it possible to retrieve the length of the PDF file?

Thanks

rikkertkoppes commented 9 years ago

Number of pages or file length?

I am currently maintaining a fork on https://github.com/theapsgroup/scissors until tcr picks it up again

sjorssnoeren commented 9 years ago

Number of pages would be nice! Thanks for your effort :)

rikkertkoppes commented 9 years ago

That's in the works, however, I am also sporadically working on the codebase.

For now, you may be able to use something like:

function getInfo(input,cb) {
    var cmd = [
        'pdftk',
        input,
        'dump_data'
    ];
    var prog = exec(cmd.join(' '),cb);
}

That's the basis for my implementation anyway

cboulanger commented 7 years ago

Done. See https://github.com/blendlabs/scissors/pull/1/commits/78cb4636f7a4f52f2cc37a040f30e87383b1d569 which has been pulled in.