I would like to know if it's possible, using a web script, to compress an uploaded PDF file using ghostscript or any other similar library. Or if Alfresco provides any other way to compress PDF files.
You have to implement a custom action in Java that uses the ghostscript library imported as a JAR in the container. Then you have to add the Spring context for the new action with all the dependencies that you need to use. Then you can execute the new action from a WebScript to compress the specified file.