kuri65536 / pdf_toc_outlines

Append outlines from TOC contents in PDF
Other
0 stars 0 forks source link

PDF TOC to outlines

append outlines (bookmarks) from the TOC contents.

from

to

to

use cases

append outlines to Google Document PDF

This is the my case. Google Document exports PDF without outlines. (at least 2024/Nov.)

this program appends outlines from these PDF.


Requirements


Usage

Build in Debian Bookworm

$ sudo apt install libmupdf-dev libmujs-dev
$ sudo apt install libjpeg-dev libgumbo-dev libopenjp2-7-dev
$ sudo apt install libjbig2dec0-dev libfreetype-dev
$ git clone https://github.com/kuri65536/pdf_toc_outlines
$ cd pdf_toc_ooutlines
$ nimble build

Run

$ ./pdf_toc_outlines sample.pdf

Options

option short parameter desc.
--output -o file-name specify the output file of PDF
--pages -p numbers search links in specified pages 1
--alg -a number specify the match condition of links 2
--levels -l number specify the leveling of links 3
--merge -m number specify the merge of links 4
--subst -s number specify the substitutes of links 5

option: --pages

specify the numbers of pages to extract TOC. under construction

usage: --pages [numbers],[numbers],...
        numbers: number | range
        number:  [-0-9]+
        range:   [number]-[number] or [number]to[number]

example::

    1. --pages 1-10 (default)
    2. --pages 1-3
    3. --pages 1,2,3
    4. --pages 1,4-10
    5. --pages 1,4,6,8-10

option: --alg

specify the algolithm to determine TOC.

parameter match condition
1 match links contains ... strings under construction
9 convert all links to outlines in specified pages (default)

option: --level

specify the algolithm for leveling the TOC links.

parameter level condition
1 x positions of link (default)
2 heading numbers under construction

option: --merge

parameter merge condition
0 no merge (default)
1 merge the links in same y position under construction

option: --subst

parameter merge condition
0 split by '.' and take the 1st string. (default)
(1) regex by the trainling string and take the 1st part of matches under construction

Under construction


License

MIT, see LICENSE


Information

If you have attract or thank to this project, Welcome to help or support with your donations.