6

How insert the outline (the bookmarks) into DjVu file for easier browsing in a document using theDjVuLibre library?

With such a structure:

  • "TOC"level 1 => link topageNumber
  • "Chapter name"level 1 => link topageNumber
    • "Chapter name"level 2 => link topageNumber
  • "Chapter name"level 1 => link topageNumber
    • "Chapter name"level 2 => link topageNumber
      • "Chapter name"level 3 => link topageNumber
  • "Chapter name"level 1 => link topageNumber
    ...
askedJul 17, 2018 at 16:32
Stilgar Dragonclaw's user avatar

2 Answers2

5

First, create your desired structure in a text editor.

On the first line will be placed keywordbookmarks in round brackets as a root.

Behind the chapter titles are located page numbers or page names (with a suffix.djvu). Before the number must be symbol sharp#. All parameters are enclosed in quotation marks"".

Lower order chapters are created by embedding additional round brackets behind higher order chapter.

Sample with page numbers:

(bookmarks    ("TOC" "#3")    ("Chapter 1 - Blabla" "#7"        ("Subchapter 1.1 - Blabla" "#11")    )    ("Chapter 2 - Blabla" "#15"        ("Subchapter 2.1 - Blabla" "#17"            ("Subchapter 2.1.1 - Blabla" "#20")        )    )    ("Chapter 3 - Blabla" "#25"))

Sample with page names (with a suffix.djvu):

(bookmarks    ("TOC" "#page_0003.djvu")    ("Chapter 1 - Blabla" "#page_0007.djvu"        ("Subchapter 1.1 - Blabla" "#page_00011.djvu")    )    ("Chapter 2 - Blabla" "#page_00015.djvu"        ("Subchapter 2.1 - Blabla" "#page_00017.djvu"            ("Subchapter 2.1.1 - Blabla" "#page_00020.djvu")        )    )    ("Chapter 3 - Blabla" "#page_00025.djvu"))

Caution: Save the file inUTF-8.

Second, paste the created outline text file into the selected DjVu file.

Install theDjVuLibre library (if you do not already have it).
From the library we usedjvused tool.

At the command prompt, type:

path\djvused path\book.djvu -e "set-outline path\outline.txt" -s

Insteadpath parameter substitute your location on the disk.
Parameter-e is the exec (system call) of theset-outline command with the filename parameter.
Parameter-s is save command.

Press Enter...

answeredJul 17, 2018 at 16:32
Stilgar Dragonclaw's user avatar
0

Although the following method does not explicitly use the DjVuLibre library (it does implicitly), the following method might save some of your precious time...

  • Use some tool to extract the contents from the djvu file. I recommendpdf_contents_extractor for python3 which can be easily installed with pip(pip3) (only tested on linux, but works for djvu too)
  • Fine-tune the contents.txt or contents_ocr.txt file with your favorite text editor
  • UseHandyOutliner to insert the bookmarks in your djvu file
answeredJul 29, 2019 at 20:13
dalanicolai's user avatar
8
  • I was not able to run HandyOutliner on Linux, and did not even find a [Mono] executable for Linux, even though the program's web page states that it is cross-platform. Would appreciate your help!CommentedAug 15, 2023 at 6:08
  • 1
    @Maxim which linux distribution are you using?CommentedAug 15, 2023 at 11:43
  • Currently -- Mint, which is Debian-basedCommentedAug 16, 2023 at 3:22
  • I used djvusmooth by Jakub WIlk for years, really liked it, and even added a Wikipedia entry on it, I believe. But it is Python 2-based, with some obsolete/legacy dependencies...CommentedAug 16, 2023 at 3:23
  • 1
    Haha, I switched from Vim to Emacs about 3 years ago, and I completely understand the joke about the keybindings:) But I am just using Vim inside Emacs (it is called evil-mode). I started with using Spacemacs, which you couldtake a look at (I have created atoc layer for it also). As a Vim user, you will be immediately able to use it, and see what Emacs all has to offer. Actually, the main reason I switched to Emacs is that Emacs made it ridiculously easy to create doc-toc.CommentedAug 17, 2023 at 11:18

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.