I am on a locked-down work machine where I cannot install third-party packages, but I need to shrink a 50MB PDF using the terminal. Is there a built-in command-line tool that can compress it natively?
There really isn’t a built in tool for this on most systems. On Mac you can try a Quartz filter through the terminal, and on Linux Ghostscript is sometimes already installed if you check with gs --version. What OS is the work machine running?
Depends what’s already on the machine. Often Ghostscript is there even when you can’t install anything, and then gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -o out.pdf in.pdf does the shrinking from terminal. Which OS is it, and is that 50MB mostly scanned images or real text? If it’s scans, compression mostly means downsampling images, and the settings matter a lot.
If you’re on Windows, I don’t think there’s a true built in terminal command for that. On Mac there is a sips/Preview trick using Automator or Quartz filters that doesn’t need installs, worth a search for your exact OS version.
Had a similar thing happen last year on a locked laptop. I am not great with the terminal, so I learned the hard way that it is usually easier to just split the file into smaller parts if size is the issue. Not sure if it works the same on Windows, but that got around my file limits.
I ran into this on a locked-down machine too. There isn’t a built-in, cross-platform command-line tool that reliably compresses PDFs; Windows in particular has no native PDF compressor. If your workplace allows it, an online PDF compressor is probably the simplest option, otherwise ask IT to provide Ghostscript or a managed compression tool.
@sharon_1980 Checking for scanned images first is exactly what I would do.
If a document is mostly image scans, compressing it too much ruins the text quality. I always look at the resolution before trying to shrink anything.
@Samantha1986 Splitting worked for me too when a big tax packet kept bouncing back by email. One thing to check though: if the recipient needs the whole document as one PDF, splitting just moves the problem along. Also if the file is a form with fillable fields, make sure the page with the fields stays intact before you send it.
@adam.green That email bounce problem is annoying. Splitting can work for size limits but it is messy if they need one file. I have had quotes bounce too. On locked machines there is often nothing built in. Not sure if it’s the same on Mac.
First thing I’d check is whether ghostscript is already on there, run gs --version. Lots of machines ship with it, and gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook shrinks files well. If it’s missing, nothing truly native exists, so I’d just use pdfcap.com instead.