@k-dang/pdf-tools 0.1.1 → 0.1.2
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 +98 -0
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
- Fast file operations using Bun runtime
|
|
11
|
+
- Built with TypeScript for type safety
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
**Requires Bun runtime.** Install [Bun](https://bun.sh) first, then:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bun install -g @k-dang/pdf-tools
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Extract Pages
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pdf-tools split <input-file> --pages <pages> [--output <output-file>]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Options
|
|
30
|
+
|
|
31
|
+
- `--pages`, `-p` - **Required.** Page numbers or ranges (e.g., `"6-8"` or `"1,3,5-8"`)
|
|
32
|
+
- `--output`, `-o` - Output filename (defaults to `<input>_split.pdf`)
|
|
33
|
+
|
|
34
|
+
#### Examples
|
|
35
|
+
|
|
36
|
+
Extract pages 6-8 from a PDF:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pdf-tools split document.pdf --pages 6-8
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Extract specific pages and ranges:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pdf-tools split document.pdf --pages "1,3,5-8" --output extracted.pdf
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Extract a single page:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pdf-tools split document.pdf --pages 10 --output page10.pdf
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Merge PDFs
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pdf-tools merge <file1.pdf> <file2.pdf> [file3.pdf ...] [--output <output-file>]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### Merge Options
|
|
61
|
+
|
|
62
|
+
- `--output`, `-o` - Output filename (defaults to `merged.pdf`)
|
|
63
|
+
|
|
64
|
+
#### Merge Examples
|
|
65
|
+
|
|
66
|
+
Merge two PDFs:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pdf-tools merge document1.pdf document2.pdf
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Merge multiple PDFs with custom output:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pdf-tools merge file1.pdf file2.pdf file3.pdf --output combined.pdf
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Page Range Format
|
|
79
|
+
|
|
80
|
+
- Single page: `"6"`
|
|
81
|
+
- Page range: `"6-8"` (includes pages 6, 7, and 8)
|
|
82
|
+
- Multiple pages/ranges: `"1,3,5-8"` (pages 1, 3, 5, 6, 7, 8)
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
### Prerequisites
|
|
87
|
+
|
|
88
|
+
You need [Bun](https://bun.sh) installed to develop this tool:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
curl -fsSL https://bun.sh/install | bash
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Setup
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
bun install
|
|
98
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-dang/pdf-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"bin": {
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
"cli",
|
|
26
26
|
"bun"
|
|
27
27
|
],
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"meow": "^14.0.0",
|
|
28
|
+
"devDependencies": {
|
|
31
29
|
"@k-dang/utils": "0.1.0"
|
|
32
30
|
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"meow": "^14.0.0"
|
|
33
|
+
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"dev": "bun run cli.ts",
|
|
35
36
|
"build": "bun run scripts/build.ts",
|