@k-dang/pdf-tools 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # pdf-tools
2
+
3
+ A fast CLI tool to extract specific pages from PDF files and merge multiple PDFs, powered by Bun.
4
+
5
+ ## Features
6
+
7
+ - Extract single pages or page ranges from PDFs
8
+ - Support for complex page specifications (e.g., `"1,3,5-8"`)
9
+ - Merge multiple PDFs into a single file
10
+ - Interactive TUI for visual file selection and page picking
11
+ - Fast file operations using Bun runtime
12
+ - Built with TypeScript for type safety
13
+
14
+ ## Installation
15
+
16
+ **Requires Bun runtime.** Install [Bun](https://bun.sh) first, then:
17
+
18
+ ```bash
19
+ bun install -g @k-dang/pdf-tools
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```bash
25
+ pdf-tools split <input-file> --pages <pages> [--output <output-file>]
26
+ pdf-tools merge <file1.pdf> <file2.pdf> [file3.pdf ...] [--output <output-file>]
27
+ pdf-tools tui
28
+ ```
29
+
30
+ ### Extract Pages
31
+
32
+ ```bash
33
+ pdf-tools split <input-file> --pages <pages> [--output <output-file>]
34
+ ```
35
+
36
+ #### Options
37
+
38
+ - `--pages`, `-p` - **Required.** Page numbers or ranges (e.g., `"6-8"` or `"1,3,5-8"`)
39
+ - `--output`, `-o` - Output filename (defaults to `<input>_split.pdf`)
40
+
41
+ #### Examples
42
+
43
+ Extract pages 6-8 from a PDF:
44
+
45
+ ```bash
46
+ pdf-tools split document.pdf --pages 6-8
47
+ ```
48
+
49
+ Extract specific pages and ranges:
50
+
51
+ ```bash
52
+ pdf-tools split document.pdf --pages "1,3,5-8" --output extracted.pdf
53
+ ```
54
+
55
+ Extract a single page:
56
+
57
+ ```bash
58
+ pdf-tools split document.pdf --pages 10 --output page10.pdf
59
+ ```
60
+
61
+ ### Merge PDFs
62
+
63
+ ```bash
64
+ pdf-tools merge <file1.pdf> <file2.pdf> [file3.pdf ...] [--output <output-file>]
65
+ ```
66
+
67
+ #### Merge Options
68
+
69
+ - `--output`, `-o` - Output filename (defaults to `merged.pdf`)
70
+
71
+ #### Merge Examples
72
+
73
+ Merge two PDFs:
74
+
75
+ ```bash
76
+ pdf-tools merge document1.pdf document2.pdf
77
+ ```
78
+
79
+ Merge multiple PDFs with custom output:
80
+
81
+ ```bash
82
+ pdf-tools merge file1.pdf file2.pdf file3.pdf --output combined.pdf
83
+ ```
84
+
85
+ ### Interactive TUI
86
+
87
+ Launch the interactive terminal UI for visual file browsing and page selection:
88
+
89
+ ```bash
90
+ pdf-tools tui
91
+ ```
92
+
93
+ The TUI provides:
94
+
95
+ - File browser for selecting PDFs
96
+ - Visual page picker for split operations
97
+ - Multi-file selection for merge operations
98
+
99
+ ## Page Range Format
100
+
101
+ - Single page: `"6"`
102
+ - Page range: `"6-8"` (includes pages 6, 7, and 8)
103
+ - Multiple pages/ranges: `"1,3,5-8"` (pages 1, 3, 5, 6, 7, 8)