UNPKG

@neilkrichi/pdf-cli

Version:

A CLI tool for splitting and merging PDF files

28 lines (27 loc) 969 B
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const merge_1 = require("./merge"); const split_1 = require("./split"); const program = new commander_1.Command(); program .name("pdf-cli") .description("A CLI tool to merge and split PDFs") .version("1.0.0"); program .command("merge <files...>") .description("Merge multiple PDFs into one") .option("-o, --output <output>", "Output file name", "merged.pdf") .action((files, options) => { (0, merge_1.mergePDFs)(files, options.output); }); program .command("split <file>") .description("Split a PDF into separate pages") .option("-o, --output <folder>", "Output folder", "output_pdfs") .option("-r, --range <range>", "Page range to split (e.g. 1-10)") .action((file, options) => { (0, split_1.splitPDF)(file, options.output, options.range); }); program.parse(process.argv);