2

I have a djvu scan of a book. Let's consider two cases:

  1. I'd like to number the pages 0, 1, 2, ... (usage case: the cover should get be page 0)

  2. I'd like to number some pages with Roman numbers and some with Arabic numbers, for example: i, ii, iii, ..., x, 1, 2, 3, ... (usage case: some introductory pages are numbered Roman in the book)

Is it possible to do it on Linux?

  • Whatever the platform, this will require a specific tool that works with lowlevel djvu specification. Just hope there is a djvulibre expert here. – orion Jun 17 '15 at 9:11
2

It's possible, but if you have to ask it's unlikely to be very useful to you. You'll need a script that produces a sequence of set-page-title commands like this:

select 1; set-page-title "Cover"
select 2; set-page-title "i"
select 3; set-page-title "ii"
select 4; set-page-title "iii"
select 5; set-page-title "1"
select 6; set-page-title "2"
select 7; set-page-title "3"
select 8; set-page-title "4"
select 9; set-page-title "5"
select 10; set-page-title "6"
...

You have to pipe these to djvused to commit the changes to your DjVu file:

djvu_pagination | djvused -f - -s file.djvu

Beware however that you have only once chance at this, if you get the numbers wrong you won't be able to run the same command again, you'll have to reset logical page numbers by referencing the component names. That goes something like this:

select "all_24223_to_00243.cpc.djvu"; set-page-title "all_24223_to_00243.cpc.djvu"
select "all_24223_to_00243.cpc0002.djvu"; set-page-title "all_24223_to_00243.cpc0002.djvu"
select "all_24223_to_00243.cpc0003.djvu"; set-page-title "all_24223_to_00243.cpc0003.djvu"
select "all_24223_to_00243.cpc0004.djvu"; set-page-title "all_24223_to_00243.cpc0004.djvu"
select "all_24223_to_00243.cpc0005.djvu"; set-page-title "all_24223_to_00243.cpc0005.djvu"
...

You'd then pipe these commands to djvused as above:

djvu_reset_pagination | djvused -f - -s file.djvu

Once upon a time people used to have scripts to handle all that. Those days are now long gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.