src/Pdf/PdfPreview.php
public function generatePdfPreview(string $pdfPath, string $imagePath, array $options = [])
    {
        if (!isset($options['absolutePdfPath']) || true !== $options['absolutePdfPath']) {
            $pdfPath = $this->webDir.'/'.$pdfPath;
        }

        if (!isset($options['absoluteImagePath']) || true !== $options['absoluteImagePath']) {
            $imagePath = $this->webDir.'/'.$imagePath;
        }
        $pdfTranscoder = isset($options['pdfTranscoder']) ? $options['pdfTranscoder'] : '';

        switch ($pdfTranscoder) {
            case 'alchemy':
                return $this->alchemyPdf($pdfPath, $imagePath, $options);

            case 'spatie':
            default:
                return $this->spatiePdf($pdfPath, $imagePath, $options);
        }
    }
public function generatePdfPreview(string $pdfPath, string $imagePath, array $options = [])
    {
        if (!isset($options['absolutePdfPath']) || true !== $options['absolutePdfPath']) {
            $pdfPath = $this->webDir.'/'.$pdfPath;
        }

        if (!isset($options['absoluteImagePath']) || true !== $options['absoluteImagePath']) {
            $imagePath = $this->webDir.'/'.$imagePath;
        }
        $pdfTranscoder = isset($options['pdfTranscoder']) ? $options['pdfTranscoder'] : '';

        switch ($pdfTranscoder) {
            case 'alchemy':
                return $this->alchemyPdf($pdfPath, $imagePath, $options);

            case 'spatie':
            default:
                return $this->spatiePdf($pdfPath, $imagePath, $options);
        }
    }
public function generatePdfPreview ( string $ pdfPath , string $ imagePath , array $ options = [ ] ) { if ( ! isset ( $ options [ 'absolutePdfPath' ] ) || true !== $ options [ 'absolutePdfPath' ] ) { $ pdfPath = $ this -> webDir . '/' . $ pdfPath ; } if ( ! isset ( $ options [ 'absoluteImagePath' ] ) || true !== $ options [ 'absoluteImagePath' ] ) { $ imagePath = $ this -> webDir . '/' . $ imagePath ; } $ pdfTranscoder = isset ( $ options [ 'pdfTranscoder' ] ) ? $ options [ 'pdfTranscoder' ] : '' ; switch ( $ pdfTranscoder ) { case 'alchemy' : return $ this -> alchemyPdf ( $ pdfPath , $ imagePath , $ options ) ; case 'spatie' : default : return $ this -> spatiePdf ( $ pdfPath , $ imagePath , $ options ) ; } }
Generate a image preview of the given pdf.

Possible PdfTranscoder: spatie (spatie/pdf-to-image), alchemy (alchemy/ghostscript)

Possible file extensions: jpg, jpeg, png

Additional options:
- string pdfTranscoder The pdf transcoder to use (default: spatie)
- int page The page to render (default: 1)
- int compressionQuality Pdf compression quality (default: null) (spatie only)
- int resolution Raster resolution (default: 144)(spatie only)
- bool absolutePdfPath Set true if pdf path is absolute (default: false)
- bool absoluteImagePath Set true if image path is absolute (default: false)

@param string $pdfPath   the relative path to the pdf file
@param string $imagePath the relative path where the image file should be saved (including file name and extension)
@param array  $options   Additional rendering options

@throws \Exception

@return bool
Generate a image preview of the given pdf .