Optimize PDFs
Last updated: Nov-23-2025
Whether you're delivering PDFs from your website, or using Cloudinary to store and share them, PDF compression may be of interest to you. By compressing PDFs, especially if they're image rich, you can benefit from big storage savings and faster download speeds.
Automatic quality for PDFs
You can optimize the size of your PDFs automatically:
- On delivery from Cloudinary
- On upload to Cloudinary
- On demand for PDFs that already exist in Cloudinary
In each case, use the automatic quality transformation (q_auto in URLs), which applies a certain amount of compression to your PDFs, while maintaining visual quality.
- Quality types such as
best,good,ecoetc. aren't yet supported when applying automatic quality to PDFs. - For Cloudinary to optimize a PDF, it can't exceed 300 pages or 200 MB in size. If it exceeds either of these limits or takes longer than 120 seconds to process, Cloudinary returns the original instead.
- Some PDFs, even below these limits, can't be optimized and reduced in size. In these cases, Cloudinary returns the original.
- PDFs with images typically benefit from better optimization than those without.
- PDF optimization is intended mainly for on-screen viewing (in a browser or PDF viewer). For high-quality printing, it's best to avoid optimizing the PDF.
- There's a special transformation count for applying automatic quality to PDFs.
Optimize PDFs on delivery
If you're storing your original uncompressed PDFs in your Cloudinary product environment, you can deliver compressed PDFs on the fly to your end users without affecting the original copy.
To deliver optimized PDFs, apply the q_auto transformation parameter to your delivery URL, either directly, or using one of our SDKs, as shown:
In this case, the original PDF is 1.8 MB and the optimized PDF is 1.1 MB.
Optimize PDFs on upload
If you want to save on storage, you can optimize PDFs on upload using an incoming transformation. In this case, the compressed version of the PDF is stored in your product environment.
Response:
Optimize previously uploaded PDFs
If you've got original, uncompressed PDFs already in your Cloudinary product environment, and you want to save some storage, you can follow these steps to overwrite an original PDF with an optimized PDF:
- Use the original PDF's URL as the upload source.
- Apply the automatic quality transformation as an incoming transformation.
- Set the public ID to match the existing PDF.
- Include the overwrite and invalidate parameters.
For example:
This applies the automatic quality transformation, overwrites the existing asset, and invalidates any cached versions on the CDN.
- Discover how to deliver specific pages of a PDF as a new PDF or as images.
- Learn how to create PDFs from a set of images.
Troubleshooting PDF optimization
If the PDF after optimization is the same size as the original, it may be because:
- This is the first time you've requested the PDF with
q_autoand the optimization didn't complete within 30 seconds. In this case, Cloudinary returns the original and continues processing the PDF for up to another 90 seconds. If successful, the next time you request the PDF withq_auto, Cloudinary returns an optimized version. - The PDF exceeds 300 pages or 200 MB, so Cloudinary can't optimize it.
- Processing takes longer than 120 seconds, so Cloudinary can't optimize it.
- The PDF is already as optimized as it can be.