mal33k-eden/gazelle-pdf-compressor

A PHP library purposely for compressing pdf. It executes qpdf commands underthehood

dev-main 2021-07-24 09:41 UTC

This package is not auto-updated.

Last update: 2024-04-19 23:04:52 UTC


README

#GPDFC - Gazelle PDF Compressor Ghostscript php wrapper purposely to reduce PDF files.

#Story GPDFC solely implements the full power of the ghost-script's shrinking (reduce filesize) capability.

I built this simple library, because I didn't get any suitable project to accomplish my PDF file reduction tasks i also got some inspiration from Alfred Klomp from www.alfredklomp.com. This library feeds a PDF through Ghostscript, which performs lossy recompression by such methods as downsampling the images to 150dpi. This configuration results in a better quality buy yet a much smaller file.

#Features

  • Shrink remote or local pdf files
  • Works on windows and unix based systems
  • More features to come

#Requirement

  • For GPDFC to work, the ghostscript command (v9.5.2) must be installed and working in the environment (development machine or server) you are using this library in. Check the links section for more help on downloads and installation of ghostscript.
  • PHP ^v7.4

#Installation You can use composer

composer require mal33k-eden/gazelle-pdf-compressor

#Links

#Usage Compress

     use  EmmKwami\GPDFC\GPDFC;
     
     * GPDFC constructor.
     * @param $inputPath  //must be a pdf file
     * @param $outputFile //name of the output pdf file after compression
     * @param $fileLocation  // (optional) either local or foreign - default = local
     * @param $environment // (optional)either uinx or windows - default = unix
     
     //instantiate GPDFC
     $GPDFC = new GPDFC('input.pdf','output.pdf');
     //Compress PDF
     $result = $GPDFC->compress());
     
 */

`