Python环境准备
micromamba create -n norm python=3.10
micromamba activate norm
## 按装pdf-compressor包
pip install pdf-compressor -i https://pypi.tuna.tsinghua.edu.cn/simplell
API申请
去https://developer.ilovepdf.com/signup注册一个账户,然后把pulic key复制保存一下。每个月可以压缩250次PDF,对大多人是够的。
在终端设置pulic key(第一次需要设置,之后就不需要了)
pdf-compressor --set-api-key project_public_XXXXXXXXXXXXXXXXXXXXXXXXXX
压缩
'extreme'可以替换为'low', 'recommended'(默认)
pdf-compressor --compression-level extreme C.pdf
小trick
如果extreme模式也不能压缩到需要的大小,可以编辑PDF,把矢量图换成像素图再进行压缩。
关于iLovePDF
The iLovePDF team is here to make managing documents effortless. From firsthand experience, we know that dealing with PDF files can be very time-consuming. Wouldn't it be better if your time was well spent instead of stressing over PDFs?
Born and based in Barcelona in 2010, our goal has always been to offer a free, accessible, and top-quality service that is easy to use. Our project started as a personal need, but it has grown to become a global community as one of the most visited PDF websites. Being able to help so many people makes each one of us feel truly lucky.
To meet as many of your needs as possible, we've developed two more applications. The iLovePDF Mobile App allows you to modify PDF files on the go, and the iLovePDF Desktop enables you to process files offline.
You showed us that all PDF problems were worth solving, and that's why our small team of developers works tirelessly to offer you an enjoyable editing experience.