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
$containerUtil
private
ContainerUtil
$containerUtil
$fileStorageUtil
private
FileStorageUtil
$fileStorageUtil
$projectDir
private
string
$projectDir
$utilsConfig
private
array<string|int, mixed>
$utilsConfig
Methods
__construct()
public
__construct(array<string|int, mixed> $utilsConfig, FileStorageUtil $fileStorageUtil, ContainerUtil $containerUtil, string $projectDir) : mixed
Parameters
- $utilsConfig : array<string|int, mixed>
- $fileStorageUtil : FileStorageUtil
- $containerUtil : ContainerUtil
- $projectDir : string
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
Return values
boolgetCachedPdfPreview()
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
Return values
stringalchemyPdf()
protected
alchemyPdf(string $pdfPath, string $imagePath[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $pdfPath : string
- $imagePath : string
- $options : array<string|int, mixed> = []
Tags
Return values
boolspatiePdf()
protected
spatiePdf(string $pdfPath, string $imagePath[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $pdfPath : string
- $imagePath : string
- $options : array<string|int, mixed> = []