Ghostscript is a software tool that can be used to change the resolution of PDFs depending upon the output devices to which these PDFs are sent. For example, this tool is capable of rendering PDFs that are suitable for monitor screens as well as the ones that are good for printers.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux System queries.
In this context, we shall look into the best way to change the resolution of a PDF on a Linux Mint 20 system using Ghostscript.
You can use the Ghostscript tool to change the resolution of a PDF on a Linux Mint 20 system as outlined below.
1. Install Ghostscript
To use Ghostscript tool to change the resolution of a PDF on a Linux system, you first need to have this tool installed on your system which can be done by running the command shown below:
$ sudo apt install ghostscript
In some of the Linux distributions, Ghostscript is installed by default on them.
2. Using Ghostscript to Find out a PDF whose Resolution you want to change
After ensuring that Ghostscript is installed on your Linux Mint 20 system, you need to locate a PDF whose resolution you want to change with this tool. We had a sample PDF named EditedPDF.pdf located in our Home directory whose resolution we wished to change. This PDF in its actual resolution.
3. Use Ghostscript to change the Resolution of the Desired PDF
Now, you need to execute the following command to change the resolution of the desired PDF with Ghostscript on your Linux Mint 20 system:
$ gs –sDEVICE=pdfwrite –dCompatibilityLevel=1.4 –dPDFSETTINGS=/screen \ -dNOPAUSE –dQUIET –dBATCH –sOutputFile=NewFile.pdf EditedPDF.pdf
Here, you need to replace NewFile.pdf with the name of the output file that you want to create with a changed resolution and EditedPDf.pdf with the target file whose resolution you want to change with Ghostscript. Moreover, instead of using the /screen option for changing the resolution of your PDF, you can also explore other options by running the command "$ gs -h" in your Linux terminal.
4. Compare the Compressed PDF with the Actual One
You can simply compare the resolution of the compressed PDF with the actual one by opening this newly created file. In our case, this compressed PDF was also created in the Home directory of our Linux Mint 20 system. You will see that the resolution of this newly created PDF is slightly different from the original PDF shown in step 2 of this method.
This article covers the step by step guide to install Ghostscript on your Linux system and use it for changing the resolutions of your desired PDFs. You can use Ghostscript command line tool for compressing a PDF file. Most Linux distributions include the open source version of Ghostscript already. However, you can still try to install it just to make sure.
On Debian/Ubuntu based distributions, use the following command to install Ghostscript:
$ sudo apt install ghostscript