Skip to Content
Retour aux modules
Productivity & Tools

PDF Compression

Shrink PDF attachments and your filestore with Ghostscript or pikepdf, on demand or on schedule.

20.0 19.0
PDF Compression
PDF Compression

Présentation du module

Nalios
Odoo Gold Partner · Belgium

/ Odoo 20 · Technical

PDF Compression

Shrink the PDF attachments that weigh on your filestore, your backups and your Odoo.sh storage. Run it on a selection, or let a scheduled action work through your whole history in the background. Free.

Free Ghostscript or pikepdf Only if 5% smaller Background batches Odoo.sh & On Premise

What it does

A lighter filestore, the same documents

Vendor bills, catalogues, scans and mail attachments pile up for years. This module recompresses them in place.

On demand

Select attachments, then Actions › Compress PDF. A notification tells you how many PDFs were compressed and how many MB you saved.

In the background

Activate the scheduled action: it takes the 50 oldest unprocessed PDFs per run and starts again until your history is done, then handles new PDFs every day.

Best of two engines

Ghostscript downsamples images (big gains on scans). pikepdf recompresses streams without loss. When both are installed, the smallest result wins.

Safe by default

A file is replaced only when the result is at least 5% smaller. Each PDF is flagged once processed, so it is never compressed twice.

Attachments list with the Compress PDF action in the Actions menu

Real numbers

Before and after, on a demo database

Odoo 19 demo data with pikepdf only, no Ghostscript: 8 of 13 PDFs rewritten, 1.0 MB saved. The 2.1 MB supplier catalogue went down to 1.35 MB and the 342 KB price list to 64 KB; PDFs that were already optimised stayed as they were. Scanned documents shrink far more with Ghostscript.

Before: PDF attachments sorted by size

Before: PDF attachments sorted by size

After: the same attachments, compressed

After: the same attachments, compressed

Setup

Install an engine, then compress

1

Add an engine

Install Ghostscript (gs) on the server and/or the pikepdf Python library (on Odoo.sh, add pikepdf to requirements.txt). At least one is required.

2

Compress a selection

Developer mode, then Settings › Technical › Database Structure › Attachments. Select PDFs, then Actions › Compress PDF.

3

Automate it

Settings › Technical › Automation › Scheduled Actions › “Attachments: compress PDFs”: activate it. It is off by default.

Notification after compression: 8 of 13 PDFs compressed, 1.0 MB saved

Under the hood

How it works

ScopePDF attachments stored in the filestore and not tied to a binary field: chatter attachments, documents, quotation documents… Files behind binary fields (for instance the invoice PDF stored on invoices) are left alone.
Ghostscript qualitySystem parameter nalios_pdf_compress.gs_quality (create it in developer mode): /screen (72 dpi), /ebook (150 dpi, default) or /printer (300 dpi).
Processed flagEvery PDF handled is flagged, including the ones kept unchanged or that failed, and is not retried.
Disk spaceThe old file is removed by Odoo’s daily filestore clean-up, so the filestore shrinks after the next autovacuum run.
AccessThe action is available to Settings administrators.
FootprintDepends on base. No new menu or screen. Ghostscript and pikepdf are optional each, so they are not declared as hard dependencies.

Read this before compressing everything

The original file is replaced and cannot be restored after the clean-up. Ghostscript is lossy: images are downsampled and the file is rewritten as PDF 1.4, so PDF/A conformance can be lost. Any rewrite, with either engine, breaks digital signatures. There is no exclusion rule by model or name: test on a copy of your database first, and keep signed documents out of scope.

A question? A problem? Talk to the people who built it.

We will get back to you within 8 business hours.

Contact us

Email us directly at

[email protected]

Published by

Nalios — Odoo Gold Partner, Belgium — nalios.be