Multiple PDF files to reduce their size using Ubuntu? Ghostscript!

Open a bash console and in the folder of the PDF files create a file and copy paste this script:

for input in *.pdf ; do
gs \
-o Analisis-${input} \
-sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook \
-dNOPAUSE \
-dQUIET \
-dBATCH \
${input}
done

Execute the file ‘./nameOfFile’

Done! We have finished!

More details:

In my case I reduced 50 PDF files in few seconds, each one aprox. from than 2.5MB per file to 400KB aprox. Now, the website where I wanted to upload them let me do it, it had a limit of 2MB per file.

A: PDF files before reduce their size.

B: Same PDF files after reducing their size. Notice that each file name is modified adding prefix “Analisis-“, just to differentiate.

1: The script which will reduce the PDF files size as batch process. The script is localized at same folder where PDF files are.

2: Execution of the script.

Yellow rectangles: Indication of the same PDF file before reduction and after reduction (2.5MB 0_25102002.pdf to 424KB Analisis-0_25102002.pdf)

GhostScript and Artifex Software saved my time and electricity! Many thanks!

Acerca de S. Vergara

Quiero compartir mis experiencias y mis humildes conocimientos
Esta entrada fue publicada en bash, Otros, Scripts. Guarda el enlace permanente.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Salir /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Salir /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Salir /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Salir /  Cambiar )

Conectando a %s