Kudus is a RHEL Sysadmin at Google. He has a report for his manager that is a pdf file. The email attachment limit on the email server is 25 MB: the file is currently 125 MB in size. How can Kudus reduce the pdf's file size to <25 MB using the tools available on his RHEL system?
To reduce the PDF file size to less than 25 MB using the tools available on a RHEL system, Kudus can follow these steps:
ghostscriptpackage if it's not already installed on the RHEL system. Use the package manager specific to RHEL, such as
yum, to install it. For example:
sudo yum install ghostscript
ghostscriptis installed, Kudus can use the
gscommand to compress the PDF file. Here's a command he can run:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
This command uses Ghostscript (
gs) to compress the PDF file. It sets the compatibility level to 1.4 and the PDFSETTINGS to
/ebook, which is suitable for reading on electronic devices. The resulting file is saved as
Please note that reducing the file size may result in some loss of quality or resolution, depending on the content of the PDF file.
After running the command, Kudus can check the resulting file size using the
ls -lh output.pdf
The output will display the file size of
If the resulting file size is still larger than the 25 MB limit, Kudus can experiment with different compression options. For example, he can try different values for the
-dPDFSETTINGSoption, such as
/printer, which provide different levels of compression.
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Kudus can run the command with different PDFSETTINGS values and check the resulting file size to find the best balance between file size and quality.
By following these steps, Kudus can use the
ghostscript tool available on his RHEL system to compress the PDF file and reduce its size to less than 25 MB, making it suitable for email attachment within the given limits.
If Kudus has any further questions or needs additional assistance, please let me know.