Guide
Why your PDF is so large
A twelve page document has no business being forty megabytes. The cause is usually one of four things, and knowing which one you have determines whether compression will help at all.
One: it is a scan
This is by far the most common cause. A scanned document is not a document, it is a stack of photographs. At 300 DPI in colour, a single A4 page is around 25 megapixels before compression. Twenty pages of that is a very large file, and no amount of structural optimisation will change it, because the images are the file.
The test is simple: try to select a line of text with your cursor. If nothing highlights, it is a scan.
The fix is to reduce the images, which means rebuilding the pages at a lower resolution and quality. That is what the rebuild mode in compress PDF does, and it commonly takes 60 to 90 percent off a scan. It is lossy, so keep the original. Scanning in greyscale rather than colour, at 200 DPI rather than 600, prevents the problem entirely.
Two: full resolution photographs
Someone dropped phone photographs into a word processor, scaled them down on the page to postcard size, and exported. The picture looks small; the stored image is still twelve megapixels. The page geometry changed, the data did not.
Fix this at source if you can: resize the images with an image compressor before placing them, and re-export. That is the only way to get a small file that still has selectable text.
Three: embedded fonts
A PDF can embed entire typefaces so it displays identically everywhere. A full font family with several weights runs to a few hundred kilobytes, and a CJK font can be several megabytes on its own. This is worth checking on a short document that is inexplicably large without containing any images.
Exporting with font subsetting enabled, which includes only the characters actually used, usually fixes it and is a setting in whatever produced the PDF rather than something to repair afterwards.
Four: incremental save history
PDF supports appending changes rather than rewriting the file, so an editor can save by adding a new version on the end. Everything you deleted is still in there. Files edited many times can be several times larger than their visible content.
This one is easy and free to fix: the repack mode of compress PDF rewrites the document, keeping only what is still referenced and packing the remaining objects efficiently. It is completely lossless. If a repack takes 40 percent off your file, this was your problem.
Which to try first
Always repack first, because it costs nothing and cannot degrade anything. If the file is still too large and you can select the text, the images are the issue and should be fixed before export. If you cannot select the text, you have a scan, and rebuilding at lower quality is the only lever available.
And the opposite problem
Some submission systems demand a minimum file size, which catches people out badly because every instinct and every tool is pointed the other way. Padding a document without altering a single visible thing is what increase PDF size does.