I found this great tool to compress pdf (python script)
Copy source files from https://github.com/hkdb/cpdf to your bin directory (that’s defined in your env) eg.
/usr/local/bin if you are on OSX.
Then just use one of the commands described in the readme of the project.
$ cpdf ebook in.pdf out.pdf
That’s all. Thank you hkdb.