This project is not covered by Drupal’s security advisory policy.

Opt-in reduction of image and scanned (image-only) PDF uploads on Webform file elements, for Drupal 11.3+ and Webform 6.3

Users/Customers often scan paperwork on a multi-function device (MFD) with "Scan to PDF", or upload phone photos. Both routinely produce 3-30 MB files. This module shrinks those files at upload time, before Drupal stores them, so every downstream consumer (submission storage, emails, handlers, exports) gets the smaller file.

What it does

JPEG / PNG / WebP:

  • Rotated upright (EXIF orientation)
  • resized to fit 2000 × 2000 px (default)
  • re-encoded in the **same format**
  • All metadata (GPS, camera serials) is removed
  • Compression options configurable
  • There is an option to convert images to JPEG, but that is documented individually

PDF, where every page is exactly one full-page JPEG or 8-bit raster image, and nothing else:
Rebuilt as a new PDF with the same page count, order, size and rotation

  • each page image down-sampled to 150 dpi (default)
  • JPEG quality 70
  • Compression options configurable

Anything else (Word, Excel, GIF, TIFF, born-digital PDFs, OCR'd/searchable PDFs, PDFs with forms, links, attachments, scripts, signatures, encryption, CMYK or black-and-white CCITT/JBIG2 scans, etc.)

  • Left untouched

The file is only replaced if the result is at least 10% smaller (default).
The file name, extension and MIME type never change.

Typical results from testing (see the security review for the full test set):
Test file - Before - After
3-page colour A4 scan @ 300 dpi (JPEG) - 8.2 MB - 0.77 MB
1-page A4 scan @ 300 dpi (lossless / Flate) - 10.2 MB - 0.26 MB
12 MP phone photo - 5.8 MB - 0.34 MB

Project information

Releases