Skip to main content

File Processing

Updated Jan 09, 2026 ·

EPUB to PDF

Easiest way to convert an EPUB to PDF is to download the Calibre Ebook Management. After downloading:

  1. Open the EPUB in the app
  2. Select the EPUB --> Convert Books
  3. Set the Output format to PDF

The output file will be saved to you Calibre Library, which is at C:\Users\username\Calibre Library

EPUB to PDF (WSL2)

I installed calibre on WSL2 on my Windows 10 machine.

sudo apt-get install -y calibre 

Verify:

calibre --version

To convert epub to pdf:

ebook-convert file.epub file.pdf --enable-heuristics 

Note: There might be issue on the images, especially the cover or front page of the book after conversion

Other options:

  • pandoc:

    sudo apt install pandoc
    pandoc -f epub -t pdf infile.epub -o outfile.pdf
  • epub2pdf

    • Download zip file from SOFTPEDIA

    • Unzip and make it executable

      chmod +x ./epub2pdf.sh 
    • Run the file:

      ./epub2pdf.sh <path-to-epub-file> 

File Readers

PDF Compression (Linux/Terminal)

You can reduce the size of large PDF files on Linux using Ghostscript. This is useful when a site has upload size limits.

sudo apt update 
sudo apt install -y ghostscript

INPUT_PDF="input.pdf"
OUTPUT_PDF="output.pdf"

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH \
-sOutputFile="$OUTPUT_PDF" "$INPUT_PDF"

# Check the new file size
ls -lh "$OUTPUT_PDF"

Where:

  • INPUT_PDF → original file
  • OUTPUT_PDF → compressed file

The -dPDFSETTINGS options:

  • /screen → lowest quality, smallest size
  • /ebook → medium quality, moderate size
  • /printer → high quality, larger size

Check the new file size:

ls -lh output.pdf