Skip to content
This repository was archived by the owner on May 19, 2023. It is now read-only.

Commit 31f5662

Browse files
committed
Update README
1 parent 6e614f3 commit 31f5662

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
A simple command line tool to split a PDF file according to the pages content.
44

5-
# Motivation
5+
## Motivation
66

77
This project is the solution to automate a process that I was doing completely manually.
88
There is a folder that contains ~250 PDF files. Each file contains one or many documents of a person, and they need to be split into different files each of which has a new name according to a format,
99
e.g. a file is named `1234.pdf` where `1234` is the ID of the person. This file contains the person's degree in the first 2 pages and the ID card in the 3rd page.
1010
So the degree will be extracted from pages 1 and 2 and named `1234-DEGREE-BACH.pdf`, assuming it's a bachelor's, and the ID card from page 3 with name `1234-IDCARD.pdf`.
1111

1212
The original files don't follow a guideline, thus it's not possible to anticipate the order of the person's documents or if any of them is present at all, so I could only think about automatizing the process of splitting and naming the new files.
13-
As a result, I developed a CLI app specifically for this problem:
13+
As a result, I developed a simple CLI specifically for this problem.
14+
15+
If you run [`main.py`](/pdf-splitter/main.py) using the `--help` argument you'll see the following:
1416

1517
```txt
1618
$ py pdf-splitter/main.py -h
@@ -27,13 +29,37 @@ optional arguments:
2729
first and last page numbers to split from the input file
2830
```
2931

30-
## Usage
32+
### Usage
33+
34+
I'm using a Windows executable generated with [`PyInstaller`](https://github.com/pyinstaller/pyinstaller), which is available in [Releases](https://github.com/netotz/pdf-splitter/releases), because the client PC containing the PDFs folder doesn't have Python installed.
35+
36+
Arguments `-s` and `-p` can be repeated as many times as needed, but both have to be repeated the same number of times.
37+
So if a file needs to be split into 3 new files, 3 file names will need to be specified, each one with `-s`, and also 3 page ranges with `-p`, respectively.
3138

32-
I'm using an executable generated with `pyinstaller` because the client PC that has the files doesn't have Python installed.
39+
The page numbers start in 0.
3340

3441
### Examples
3542

36-
Following the previous example:
43+
Assume this is the folder, and you're using the executable:
44+
45+
```txt
46+
folder/
47+
├─ pdf-splitter.exe
48+
├─ 1234.pdf
49+
```
50+
51+
Following the previous example, running this inside `folder/`:
52+
3753
```txt
3854
pdf-splitter -s DEGREE-BACH -s IDCARD -p 0 1 -p 2 2 1234.pdf
3955
```
56+
57+
Will result in:
58+
59+
```txt
60+
folder/
61+
├─ pdf-splitter.exe
62+
├─ 1234.pdf - 3 pages
63+
├─ 1234-DEGREE-BACH.pdf - 2 pages
64+
├─ 1234-IDCARD.pdf - 1 page
65+
```

0 commit comments

Comments
 (0)