pvc1989 / pdfbookmarker

Add bookmarks into PDF using PyPDF2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDFBookmarker

Add bookmarks into PDF using PyPDF2.

Installation

Install pdfbookmarker:

$ 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:

    <nested level>"<bookmark title>"|<page number>
    

    For samples, see sample_bookmarks.txt. (Offsets are also supported, see here)

  2. Generate a copy of MyBook.pdf with additional bookmarks file specified by my_bookmarks.txt:

    $ 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:

    $ pdfbm MyBook.pdf my_bookmarks.txt MyBook_with_bookmarks.pdf

License

MIT

About

Add bookmarks into PDF using PyPDF2


Languages

Language:Python 96.3%Language:Makefile 3.7%