Contao Utils Bundle

PdfPreview
in package

Table of Contents

Properties

$containerUtil  : ContainerUtil
$fileStorageUtil  : FileStorageUtil
$projectDir  : string
$utilsConfig  : array<string|int, mixed>

Methods

__construct()  : mixed
generatePdfPreview()  : bool
Generate a image preview of the given pdf.
getCachedPdfPreview()  : string
alchemyPdf()  : bool
spatiePdf()  : bool

Properties

$utilsConfig

private array<string|int, mixed> $utilsConfig

Methods

generatePdfPreview()

Generate a image preview of the given pdf.

public generatePdfPreview(string $pdfPath, string $imagePath[, array<string|int, mixed> $options = [] ]) : bool

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)
Parameters
$pdfPath : string

the relative path to the pdf file

$imagePath : string

the relative path where the image file should be saved (including file name and extension)

$options : array<string|int, mixed> = []

Additional rendering options

Tags
throws
Exception
Return values
bool

getCachedPdfPreview()

public getCachedPdfPreview(string $pdfPath[, array<string|int, mixed> $options = [] ][, string $fileExtension = 'jpg' ]) : string
Parameters
$pdfPath : string

The path to the pdf file

$options : array<string|int, mixed> = []

Additional rendering options. See generatePdfPreview

$fileExtension : string = 'jpg'
Tags
throws
Exception
Return values
string

alchemyPdf()

protected alchemyPdf(string $pdfPath, string $imagePath[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$pdfPath : string
$imagePath : string
$options : array<string|int, mixed> = []
Tags
throws
Exception
Return values
bool

spatiePdf()

protected spatiePdf(string $pdfPath, string $imagePath[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$pdfPath : string
$imagePath : string
$options : array<string|int, mixed> = []
Tags
throws
Exception
Return values
bool

        
On this page

Search results