Take the 2-minute tour ×
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.

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.

Thanks!

share|improve this question
add comment

2 Answers 2

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"
done

# 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
of="${if%.*}.$from-$to.djvu"
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
add comment

I would just use:
DjVuLibre DjView 4.5
Viewer for DjVu documents

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

Your Answer

 
discard

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.