PDF Optimizer
  • 🏁Getting Started
    • Introduction
    • Installation
    • Support Us
    • License
  • 🚀Basic Usage
    • Standalone PHP
    • Laravel
  • ⚙️Advanced Usage
    • Ghostscript Binary Configuration
    • Timeout
    • Logger
    • Custom Ghostscript Options
    • Export Script
    • Configuring Ghostscript
      • ASCII85EncodePages
      • AutoFilterColorImages
      • AutoFilterGrayImages
      • AutoRotatePages
      • ColorConversionStrategy
      • ColorImageDepth
      • ColorImageFilter
      • ColorImageDownsampleThreshold
      • ColorImageDownsampleType
      • ColorImageResolution
      • CompatibilityLevel
      • CompressFonts
      • CompressPages
      • ConvertCMYKImagesToRGB
      • DefaultRenderingIntent
      • DetectDuplicateImages
      • DownsampleColorImages
      • DownsampleGrayImages
      • DownsampleMonoImages
      • EmbedAllFonts
      • EncodeColorImages
      • EncodeGrayImages
      • EncodeMonoImages
      • FastWebView
      • GrayImageDepth
      • GrayImageDownsampleThreshold
      • GrayImageDownsampleType
      • GrayImageFilter
      • GrayImageResolution
      • LockDistillerParams
      • MaxInlineImageSize
      • MaxSubsetPct
      • MonoImageDepth
      • MonoImageDownsampleThreshold
      • MonoImageDownsampleType
      • MonoImageFilter
      • MonoImageResolution
      • PassThroughJPEGImages
      • PassThroughJPXImages
      • ParseDSCComments
      • ParseDSCCommentsForDocInfo
      • PDFA
      • PDFACompatibilityPolicy
      • PDFX
      • PreserveEPSInfo
      • PreserveHalftoneInfo
      • PreserveMarkedContent
      • PreserveOPIComments
      • PreserveOverprintSettings
      • ProcessColorModel
      • PDFSETTINGS
      • SubsetFonts
      • UCRandBGInfo
      • UseFlateCompression
  • 🎮Laravel Deep Dive
    • Filesystem
    • Queue
Powered by GitBook
On this page

Was this helpful?

  1. Advanced Usage

Ghostscript Binary Configuration

Customize the Ghostscript binary path used by pdf-optimizer to match your environment. This option provides flexibility in specifying the exact location of the Ghostscript binary on your server.

You can specify the exact path to the Ghostscript binary file by passing it to the init method of the PdfOptimizer class.

use Mostafaznv\PdfOptimizer\PdfOptimizer;

PdfOptimizer::init('/path/to/gs')->optimize('input.pdf', 'output.pdf');

You can specify the exact path to the Ghostscript binary file using the setGsBinary method of the PdfOptimizer class.

use Mostafaznv\PdfOptimizer\Laravel\Facade\PdfOptimizer;

PdfOptimizer::fromDisk('files')
    ->open('input-1.pdf')
    ->setGsBinary('/usr/local/bin/gs')
    ->toDisk('s3')
    ->optimize('output-1.pdf');

Note: The setGsBinary method must be called after the fromDisk and open methods. This option is specifically available during the exporting phase of the optimization process.

PreviousLaravelNextTimeout

Last updated 1 year ago

Was this helpful?

⚙️