@@ -11,19 +11,20 @@ Features
1111 + [x] Image inputs (e.g. PNG, JPG, etc.)
1212 + [ ] Markdown inputs
1313+ [x] ** Merge PDFs** : Merge multiple PDFs into one PDF
14- + [x] ** Split PDFs** : Split a PDF into multiple PDFs, each containing a range of pages from
15- the original PDF
14+ + [x] ** Split PDFs** : Split a PDF into multiple PDFs, each containing a range of pages
1615+ [x] ** Export as image** : Export designated pages from a PDF as image files
1716+ [x] ** Remove pages** : Remove designated pages from a PDF
17+ + [x] ** Extract text** : Export text from a PDF file and optionally save it to a text file
18+ + [x] ** Recipe system** : Chain multiple operations together using YAML recipe files
19+ + [ ] Add watermark to a PDF
1820+ [ ] Encrypt a PDF
1921+ [ ] Decrypt a PDF
20- + [ ] Add watermark to a PDF
2122+ [ ] Extract images from a PDF
22- + [x] ** Extract text** : Export text from a PDF file and optionally save it to a text file
2323+ [ ] Extract links from a PDF
24+ + [ ] Set PDF metadata (title, author, etc.)
2425
25- If you want any other feature to be added, feel free to open an [ issue] ( https://github.com/MPCodeWriter21/PDF-To-Image /issues )
26- or fork the repo and make a [ pull request] ( https://github.com/MPCodeWriter21/PDF-To-Image /pulls )
26+ If you want any other feature to be added, feel free to open an [ issue] ( https://github.com/MPCodeWriter21/PDF-Helper /issues )
27+ or fork the repo and make a [ pull request] ( https://github.com/MPCodeWriter21/PDF-Helper /pulls )
2728after adding your contribution.
2829
2930Usage
@@ -67,8 +68,8 @@ Bundle multiple files into one PDF:
6768``` bash
6869pdf-helper bundle < input_file_1> < input_file_2> ... < input_file_n> < output_file>
6970
70- # E.g. Merge PDFs 1, 2 and 3 into a new PDF
71- pdf-helper merge 1.pdf 2.pdf 3.pdf new.pdf
71+ # E.g. Bundle PDFs 1, 2 and 3 into a new PDF
72+ pdf-helper bundle 1.pdf 2.pdf 3.pdf new.pdf
7273
7374# E.g. Take 1.png, 2.jpg, and 3.png and create a PDF named 123.pdf and override
7475# if already exists
@@ -130,6 +131,117 @@ pdf-helper extract-text <input_file> -o <output_file_name>
130131pdf-helper extract-text my-pdf.pdf -o my-text.txt
131132```
132133
134+ ### Run Recipes
135+
136+ The recipe system lets you chain multiple PDF operations together in a single run
137+ using a YAML file. This unlocks features not available through individual CLI
138+ commands (e.g. selecting specific pages per file when bundling).
139+
140+ ``` bash
141+ pdf-helper run-recipe < recipe_file.yaml>
142+
143+ # E.g. Run a simple recipe
144+ pdf-helper run-recipe remove-pages.yaml
145+
146+ # E.g. Run with force overwrite and verbose logging
147+ pdf-helper run-recipe bundle-workflow.yaml --force --verbose
148+ ```
149+
150+ #### Recipe File Format
151+
152+ A recipe is a YAML file with a ` steps ` list. Each step has an ` id ` , an
153+ ` operation ` , input/output paths, and operation-specific options. Steps can
154+ reference each other's outputs using ` { step: step_id } ` .
155+
156+ ``` yaml
157+ name : " Remove specific pages"
158+ description : " Removes pages 2, 4, 6 from a PDF."
159+ version : " 1.0"
160+
161+ steps :
162+ - id : clean
163+ operation : remove_pages
164+ input : document.pdf
165+ pages_to_remove : [2, 4, 6]
166+ output : cleaned.pdf
167+ ` ` `
168+
169+ #### Supported Operations
170+
171+ | Operation | Status | Description |
172+ |---|---|---|
173+ | ` bundle` | Available | Bundle files with optional per-file page selection |
174+ | `remove_pages` | Available | Remove pages by 1-based index |
175+ | `split_pdf` | Available | Split at given page boundaries |
176+ | `pdf_to_image` | Available | Render pages as PNG images |
177+ | `extract_text` | Available | Extract text content |
178+ | `watermark` | Planned | Add text watermark (graceful fallback) |
179+ | `encrypt` | Planned | Password-protect PDF (graceful fallback) |
180+ | `metadata` | Planned | Set title/author/keywords (graceful fallback) |
181+
182+ Operations marked *Planned* are not yet implemented — the recipe runner
183+ logs a warning and copies the input file through, so pipelines don't break.
184+
185+ # ### Advanced Example: Multi-step Pipeline
186+
187+ ` ` ` yaml
188+ name: "Split, Convert, and Extract Pipeline"
189+ version: "1.0"
190+
191+ settings:
192+ temp_dir: "./.recipe-tmp"
193+
194+ steps:
195+ # Step 1: Split the PDF at pages 5 and 10
196+ - id: split
197+ operation: split_pdf
198+ input: report.pdf
199+ split_points: [5, 10]
200+ output_dir: .
201+ output_prefix: "report_part_"
202+
203+ # Step 2: Convert the second chunk to images
204+ - id: to_images
205+ operation: pdf_to_image
206+ input:
207+ step: split
208+ file: report_part_2.pdf
209+ pages: "1-3"
210+ scale: 3
211+ output: ./output/images
212+
213+ # Step 3: Extract text from the first chunk
214+ - id: extract
215+ operation: extract_text
216+ input:
217+ step: split
218+ file: report_part_1.pdf
219+ pages: "1-4"
220+ max_characters: 5000
221+ reverse_lines: true
222+ output: ./output/chapter-1-text.txt
223+ ` ` `
224+
225+ # ### Recipe Settings
226+
227+ | Setting | Default | Description |
228+ |---|---|---|
229+ | `temp_dir` | `./.recipe-tmp` | Directory for intermediate files |
230+ | `overwrite` | `false` | Overwrite existing output files |
231+ | `cleanup_temp` | `false` | Remove temp directory after completion |
232+
233+ Input values (e.g. passwords) can be sourced from environment variables or
234+ prompted at runtime :
235+
236+ ` ` ` yaml
237+ inputs:
238+ password:
239+ env: PDF_PASSWORD
240+ prompt: "Enter output PDF password"
241+ ` ` `
242+
243+ See [`examples/recipes/`](examples/recipes) for more example recipe files.
244+
133245About
134246-----
135247
0 commit comments