### Checking pdftotext Binary Installation - Bash Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Command to verify if the `pdftotext` binary, required by the package, is installed and available in the system's PATH. If installed, it will output the path to the binary. ```Bash which pdftotext ``` -------------------------------- ### Installing the Package - Bash Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Command to install the `spatie/pdf-to-text` PHP package into your project using Composer, the PHP dependency manager. ```Bash composer require spatie/pdf-to-text ``` -------------------------------- ### Installing pdftotext (RedHat/CentOS/Rocky/Fedora) - Bash Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Command to install the `poppler-utils` package, which includes the `pdftotext` binary, on RedHat, CentOS, Rocky Linux, or Fedora systems using the `yum` package manager. ```Bash yum install poppler-utils ``` -------------------------------- ### Installing pdftotext (Mac) - Bash Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Command to install the `poppler` package, which contains the `pdftotext` binary, on macOS using the Homebrew package manager. ```Bash brew install poppler ``` -------------------------------- ### Installing pdftotext (Ubuntu/Debian) - Bash Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Command to install the `poppler-utils` package, which includes the necessary `pdftotext` binary, on Ubuntu or Debian based Linux distributions using the `apt-get` package manager. ```Bash apt-get install poppler-utils ``` -------------------------------- ### Running Tests - Bash Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Command to execute the package's test suite using Composer. ```Bash composer test ``` -------------------------------- ### Setting pdftotext Options (Static) - PHP Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Shows how to pass options to the underlying `pdftotext` command as the third parameter when using the static `getText` method. ```PHP echo Pdf::getText('book.pdf', null, ['layout', 'opw myP1$$Word']); ``` -------------------------------- ### Adding pdftotext Options (Object) - PHP Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Demonstrates how to add options to the underlying `pdftotext` command using the `addOptions` method on a `Pdf` object instance. This method appends options to the existing list, useful for adding context-specific options. ```PHP $text = (new Pdf()) ->setPdf('table.pdf') ->setOptions(['layout', 'r 96']) ->addOptions(['f 1']) ->text() ; ``` -------------------------------- ### Setting pdftotext Options (Object) - PHP Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Demonstrates how to pass options to the underlying `pdftotext` command using the `setOptions` method on a `Pdf` object instance. Note that successive calls to `setOptions` will overwrite previously set options. ```PHP $text = (new Pdf()) ->setPdf('table.pdf') ->setOptions(['layout', 'r 96']) ->text() ; ``` -------------------------------- ### Using Custom pdftotext Path (Object) - PHP Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Demonstrates how to specify a custom path to the `pdftotext` binary by passing it to the `Pdf` object constructor, useful if the binary is not in the default system location. ```PHP $text = (new Pdf('/custom/path/to/pdftotext')) ->setPdf('book.pdf') ->text(); ``` -------------------------------- ### Using Custom pdftotext Path (Static) - PHP Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Shows how to specify a custom path to the `pdftotext` binary as the second parameter when using the static `getText` method. ```PHP echo Pdf::getText('book.pdf', '/custom/path/to/pdftotext'); ``` -------------------------------- ### Basic Text Extraction (Object) - PHP Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Shows how to extract text from a PDF file by creating a `Pdf` object instance, setting the path to the PDF file using `setPdf`, and then calling the `text` method. ```PHP $text = (new Pdf()) ->setPdf('book.pdf') ->text(); ``` -------------------------------- ### Basic Text Extraction (Static) - PHP Source: https://github.com/spatie/pdf-to-text/blob/main/README.md Demonstrates the simplest way to extract text from a PDF file using the static `getText` method of the `Spatie\PdfToText\Pdf` class. This method returns the extracted text directly. ```PHP use Spatie\PdfToText\Pdf; echo Pdf::getText('book.pdf'); //returns the text from the pdf ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.