View Single Post
Old 03-01-2012, 03:58 PM   #4
AndiPersti
Junior Member
AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.AndiPersti invented the internet.
 
Posts: 9
Karma: 84230
Join Date: Jul 2011
Device: PocketBook 902
DjVu has the possibility to add a TOC (called "outline") to a document.

The problem is that the very limited outline creation feature ("Bookmark this page" - ctrl+b) of djvusmooth produces an outline that apparently the PB DjVu-viewer doesn't understand correctly. (I don't have problems with the desktop "DjView"-viewer)

But you can edit the outline manually:
The basic syntax is:
Code:
(bookmarks
    ("Chapter 1" "#pagenumber")
    ("Chapter 2" "#pagenumber")
    ...
)
You can also have nested chapters like so:
Code:
(bookmarks
    ("Chapter 1" "#pagenumber"
         ("Section 1.1" "#pagenumber")
         ("Section 1.2" "#pagenumber")
    )
    ("Chapter 2" "#pagenumber")
    ...
)
Save your outline in a text file and then open your document with djvused (a commandline djvu editor - it's part of the "djvulibre-bin"-package on which "djvusmooth" depends thus you should have it already):
Code:
$> djvused document.djvu
Now you are in the interactive mode and you can print the current outline with "print-outline", set it with "set-outline toc-file" ("toc-file" is the text file you have manually created) and save your changes with "save". (You can leave "djvused" with ctrl+c or any unknown command).

Alternatively you can use "djvused" non-interactively:
Code:
$> djvused document.djvu -e "set-outline toc-file" -s
This will change the outline and saves the document with the current name.
See the above link for further details on "djvused" or use "man djvused"

Bye, Andreas

PS: The only problem I've noticed so far is with deeply nested structures like
Code:
(bookmarks
    ("Level 1a" "#nr"
        ("Level 2a" "#nr"
            ("Level3a" "#nr"
                ("Level4a" "#nr")
            )
            ("Level3b" "#nr"
                ("Level4b" "#nr")
                ("Level4c" "#nr")
            )
        )
    )
)
where some elements (not all) of the third and fourth level aren't recognised by the PB-viewer (but all show up in "DjView")
AndiPersti is offline   Reply With Quote