0.1.1 • Published 7 years ago

scan-pdf-blocks-pmb v0.1.1

Weekly downloads
6
License
ISC
Repository
github
Last release
7 years ago

scan-pdf-blocks-pmb

Parse the outer structure of some¹ PDF documents, and offer to parse some of the deeper structures.

¹ Currently these flavors of PDF are supported:

  • PDF v1.5 as produced by Firefox 54.0 on Ubuntu
  • Maybe others as well, you'll have to try.

Usage

from test/dummy-form-blocks.js:

var fs = require('fs'), scanPdfBlk = require('scan-pdf-blocks-pmb');

fs.readFile(exaDir + 'dummy-form.pdf', function (err, fileBytes) {
  if (err) { throw err; }
  var pdf, parseOpt = { preview: [64, 32],
    indexByType: true,
    indexByOffset: true,
    };
  pdf = scanPdfBlk.parsePdfBuffer(fileBytes, parseOpt);
  pdf.getBlocksByProp('type', 'xref', -1).parse();
  knownGood.verify(pdf, 'blocks');
});

Example results of .parsePdfBuffer can be found in the blocks section of test/expect/dummy-form-blocks.json.

Known issues

  • needs more/better tests and docs

 

License

ISC