Convert pdf to cbr

#!/bin/sh
 
mkdir "`basename \"$1\" .pdf`"
cp "$1" "`basename \"$1\" .pdf`/bd.pdf"
cd "`basename \"$1\" .pdf`"
pdftohtml -nodrm bd.pdf
 
for f in *.jpg
do 
    convert -compress JPEG2000 -quality 75 -verbose $f out.jpg; 
    cp out.jpg $f; 
done
rm *.html *.pdf out.jpg; 
 
rar a "../`basename \"$1\" .pdf`.cbr" *; 
cd ..; 
rm -rf "`basename \"$1\" .pdf`"

You will need pdftohtml, imagemagick and rar to be installed.
On debian-based system:

sudo apt-get install poppler-utils imagemagick rar
  1. Génial !

    Merci.

    Je ferai un lien vers cet article sur mon blog

  1. No trackbacks yet.