https://github.com/russellluo/pdfbookmarker
Add bookmarks into PDF using PyPDF2
https://github.com/russellluo/pdfbookmarker
Last synced: 12 months ago
JSON representation
Add bookmarks into PDF using PyPDF2
- Host: GitHub
- URL: https://github.com/russellluo/pdfbookmarker
- Owner: RussellLuo
- Created: 2013-10-26T14:41:21.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2023-09-01T13:35:04.000Z (almost 3 years ago)
- Last Synced: 2024-12-06T06:11:53.352Z (over 1 year ago)
- Language: Python
- Size: 17.6 KB
- Stars: 82
- Watchers: 6
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PDFBookmarker
Add bookmarks into PDF using [PyPDF2][1].
## Installation
Install pdfbookmarker:
```bash
$ pip install pdfbookmarker
```
## Usage
1. Turn to your target PDF (e.g. `MyBook.pdf`), record bookmark titles and page
numbers of the PDF into a TEXT file (e.g. `my_bookmarks.txt`) **by hand**
with the following format:
```
""|
```
For samples, see [sample_bookmarks.txt](sample_bookmarks.txt). (Offsets are also
supported, see [here](https://github.com/RussellLuo/pdfbookmarker/pull/7#issuecomment-711136889))
2. Generate a copy of `MyBook.pdf` with additional bookmarks file specified by
`my_bookmarks.txt`:
```bash
$ pdfbm MyBook.pdf my_bookmarks.txt
```
An auto-detected, expected or suggested filename for bookmarks is `MyBook.txt`,
when the input filenamne e.g. is `MyBook.pdf`.
The default filename of the output PDF is `MyBook-new.pdf`; You, of course, can
specify the filename explicitly:
```bash
$ pdfbm MyBook.pdf my_bookmarks.txt MyBook_with_bookmarks.pdf
```
## License
[MIT][2]
[1]: https://github.com/mstamy2/PyPDF2
[2]: http://opensource.org/licenses/MIT