Split PDF into a separate file in Javascript

I have a large PDF file, and I would like to split it into separate PDF files, each page in a separate file.

This can be done in JS with the node module.

I am looking, but in npm I only have modules that convert html to pdf

+2
source share
2 answers

After a long search and almost surrender, I eventually found that the HummusJS library would do what I want! thanks @Taxilian

See this post. How to create a custom version of an existing pdf file with node.js?

+1
source

PDF javascript. js libs,

PDF node.js

pdftk pdf

pdftk input.pdf burst output output_%02d.pdf

child-process

var exec = require('child_process').exec,
    child;

child = exec('pdftk input.pdf burst output output_%02d.pdf',
  function (error, stdout, stderr) {
    console.log('stdout: ' + stdout);
    console.log('stderr: ' + stderr);
    if (error !== null) {
      console.log('exec error: ' + error);
    }
});

pdftk split pdf

, node pdftk,

+2

Source: https://habr.com/ru/post/1657738/


All Articles