Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a djvu file of multiple pages. I wonder how to extract a new djvu file that consists of only a subset of multiple pages?

For example, a djvu file has 10 pages, and I would like to extract a new djvu file consisting of pages 3-6 of the original djvu file. Can it be done with some commands of djvulibre, such as djvused, djvm, ...? I am using Ubuntu Linux.

Consider two different cases: extract without removal of pages from the original djvu file, and extract without removal.


share|improve this question

I didn't see any way to explicitly save a range of pages, so I opted to delete the rest.

# Extract and save each page in its own file
pages=$(djvused -e 'n' "$if")
for ((i=1; i<=$pages; i++)) ;do
    of="${if%.*}.$(printf "%03d" $i).djvu"
    djvused -e "select $i; save-page-with \"$of\"" "$if"

# Remove one page from an existing djvu file
djvm -delete "$if" 2 # remove page 2

# Save pages 3-6 to a new file, by removing 
#   all other pages from a copy of the original
from=3; to=6
cp "$if" "$of"  
pages=$(djvused -e 'n' "$of")
for ((i=$pages; i>$to; i--)) ;do  djvm -delete "$of" $i ;done
for ((i=1;    i<$from; i++)) ;do  djvm -delete "$of" 1  ;done
share|improve this answer

I would just use: DjVuLibre DjView 4.5 Viewer for DjVu documents. Its GUI has a Save as function under File menu and there one can save a given range of pages into djvu file.

share|improve this answer
How is djview possible to extract multiple pages from a djvu file? – Tim Jan 16 '12 at 17:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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