kristos80 / piima
A, really, simple utility for working with PDF files
1.0.2
2021-05-12 11:39 UTC
Requires
This package is auto-updated.
Last update: 2025-03-12 20:19:39 UTC
README
Piima
A, really, simple utility for working with PDF files.
For now it can do 2 distinct things (see public methods):
- Convert any page of a PDF file to an image
- Calculate the total pages of a PDF file
Dependencies
The package is dependent on ghostscript
Public methods
public static extractImage(string $pdf, string $image, int $page = 1, bool $silent = FALSE) : bool
// Creates an image from the first page of the pdf file // and returns `TRUE` or FALSE or throws an exception $thumbnailCreated = Piima::extractImage($pdf, $image); // Creates an image from the 5th page of the pdf file // and returns `TRUE` or FALSE or throws an exception $thumbnailCreated = Piima::extractImage($pdf, $image, 5); // Creates an image from the 5th page of the pdf file // and returns `TRUE` or `FALSE` without throwing an exception $thumbnailCreated = Piima::extractImage($pdf, $image, 5, TRUE);
public static calculateTotalPages(string $pdf, bool $silent = FALSE): int
// Calculates total page of PDF file as an integer // and returns it or throws an exception Piima::calculateTotalPages($pdf); // Calculates total page of PDF file as an integer // and returns it without throwing an exception Piima::calculateTotalPages($pdf, TRUE);