How to convert calibre (cbr) to pdf format in Linux?

7,138

Solution 1

CBR is just a renamed RAR archive containing sequentially numbered images inside. Install UnRAR from the Software Center and extract the archive.

Then using ImageMagick you can convert the images to PDF like so: convert *.jpg out.pdf

If you want a GUI, use gscan2pdf.

Edit: BTW, why do you want to convert? There are great Comic Book Readers apps available on virtually every platform (see here and here for Linux apps), and CBRs/CBZs (renamed ZIP archives) are way better than PDFs.

Solution 2

Calibre has a command-line interface if you're unable to get the GUI to come up for some reason. You can use that to convert.

This manual explains the command line usage and options: http://manual.calibre-ebook.com/cli/ebook-convert.html

Here is some more information on Calibre's E-Book Conversion capabilities: http://manual.calibre-ebook.com/conversion.html

Aside from Calibre, there aren't many ideal options for e-book conversion. I would try reinstalling Calibre. Ubuntu 12.04 also uses an outdated version of Calibre. The Calibre website recommends installing the latest version from the website, rather than any distro's package management utility. Calibre updates are released every week, including bug fixes, enhancements (especially to the conversion system). The distros are regularly many versions behind. Directions for installing the updated version of Calibre are here: http://calibre-ebook.com/download_linux

Here is a listing of other options for converting ebooks on multiple platforms and multiple platforms. If you can't get Calibre to work, I would suggest trying some of them: http://wiki.mobileread.com/wiki/E-book_conversion

CBR is unrelated to Calibre. It's an archive file for sequential viewing of images. You can read more about that here: http://en.wikipedia.org/wiki/Comic_book_archive

Solution 3

Unfortunately convert and calibre changes the image quality/resolution, which is very important to CBR and CBZ, so to have no loss of quality, practically using the original jpg that is inside the CBR(CBZ) files you need to use img2pdf, I use this commands:

First need to install this:

sudo apt install img2pdf p7zip-full

1) This to make a pdf file out of every jpg image without loss of either resolution or quality:

ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf

2) This to concatenate the pdfpages into one:

pdftk *.pdf cat output combined.pdf

I made this batch files

./cbr2pdf.sh:

#!/bin/bash
set -xev
ORIGINAL_FOLDER=`pwd` 
JPEGS=`mktemp -d`
cp "$1" "$JPEGS"
cd "$JPEGS"
7z e "$1" 
ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf
pdftk *.pdf cat output combined.pdf
cp "$JPEGS/combined.pdf" "$ORIGINAL_FOLDER/$1.pdf"

cat cbz2pdf.sh

#!/bin/bash
#set -xev
ORIGINAL_FOLDER=`pwd` 
JPEGS=`mktemp -d`
unzip -j "$1" -d "$JPEGS"
cd "$JPEGS"
ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf
pdftk *.pdf cat output combined.pdf
cp "$JPEGS/combined.pdf" "$ORIGINAL_FOLDER/$1.pdf"

To convert all cbr and cbz in the folder and subfolders:

tree -fai . | grep -P "cbr$" | xargs -L1 -I{} ./cbr2pdf.sh {}

and

tree -fai . | grep -P "cbz$" | xargs -L1 -I{} ./cbz2pdf.sh {}
Share:
7,138

Related videos on Youtube

wbad
Author by

wbad

Updated on September 18, 2022

Comments

  • wbad
    wbad almost 2 years

    I have a comic strip book in cbr (Calibre?) format. How can I convert it to pdf in my Ubuntu 12.04? I tried to install calibre hoping that it is able to do so. But it seems to be buggy and does not show up. Appreciate your hints to do the conversion.

  • wbad
    wbad over 11 years
    Wanted to post it in a forum that does not accept cbr format. Thanks for your help.
  • Karan
    Karan over 11 years
    Ah I see. Oh well, their loss. :)