Skip to content

Latest commit

 

History

History
70 lines (41 loc) · 1.77 KB

README.md

File metadata and controls

70 lines (41 loc) · 1.77 KB

pdfrex

PDF manipulation module for Deno - split, merge, rotate, watermark, etc. (uses pdf-lib library).

Install

deno install --allow-read --allow-write -n pdfrex https://deno.land/x/[email protected]/mod.ts

This adds the command line tool pdfrex with two subcommands split and merge.

Merge

Usage: pdfrex merge

Description:

    Merge pdf files

Options:

    -h, --help              - Show this help.
    -d, --dir     <string>  - Directory to merge pdfs from
    -f, --files   <string>  - Files to merge (separated by a comma)
    -o, --output  <string>  - File path to write merged pdf to

Split

Usage: pdfrex split

Description:

    Split pdf files

Options:

    -h, --help                  - Show this help.
    -d, --dir         <string>  - Directory to split pdfs from
    -f, --files       <string>  - Files to split (separated by a comma)
    -o, --output-dir  <string>  - Directory to output results to
    -p, --prefix      <string>  - Prefix of resulting files

Split pdf files in current directory

deno run --allow-read --allow-write https://deno.land/x/[email protected]/split.ts

or:

import { splitAll, splitPdf } from "https://deno.land/x/[email protected]/mod.ts";

// split all pdfs in working dir
splitAll();

// specify file path
splitPdf("/path/to/your/input_file.pdf");

Merge pdf files in current directory

deno run --allow-read --allow-write https://deno.land/x/[email protected]/merge.ts

or:

import { mergeAll, mergePdfs } from "https://deno.land/x/[email protected]/mod.ts";

// merge all pdfs in working dir
mergeAll();

// specify files to merge
mergePdfs(["file1.pdf", "file2.pdf", "file3.pdf"]);