2

Is there a simple way to renumber pages in a DJVU file?

Example: I've got a book, and page 1 is actually the cover, and so on, such that the actual page 1 of the book is at, say, 10 in the document; what I'd like to do is call them something like C,i,ii,..., and then 1,2,...

I know it can be done, since I've got other books in this format with this numbering, and I'd like to do it on Linux, better if via terminal.

Thanks, N

jj_p
  • 153
  • 8

2 Answers2

3

to renumber

for (( i=11; i<=823; i++ ))
do
 djvused new.djvu -e "select $i; set-page-title $((i-10)); save"
done

to rename

djvused new.djvu -e 'select 2; set-page-title ii; save'
jj_p
  • 153
  • 8
  • 1
    Here is a better alternative. First, use `echo` to dump the `select` and `set-page-title` pairs (without `save`) into a script file. Then call `djvused new.djvu -s -f script-file`. This alternative invoke the `save` command only once and is much faster. – Eli4ph Jul 16 '18 at 08:59
  • I wrote a script to automatically generate the commands for both arabic and roman numbers, including optional cover and back options and skipped pages, on a similar question on unix.stackexchange: https://unix.stackexchange.com/a/578110/224735 – hife Mar 12 '21 at 12:18
1

It's slightly offtopic. Just in case someone needs to do the same thing on Windows using PowerShell:

for($i=11; $i -le 823; $i++){
  $j=($i-10)
  $args = "new.djvu -e ""select $i; set-page-title $j; save""" 
  write-host "djvused $args"
  start-process djvused $args -NoNewWindow -wait
}
Nico
  • 160
  • 1
  • 4