Download the PHP package shibashish/pdf-reader without Composer

On this page you can find all versions of the php package shibashish/pdf-reader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pdf-reader

PDF Reader Package for Laravel

A comprehensive, production-ready Laravel package for extracting content from PDF files using Poppler utilities. This package provides a secure, type-safe interface for PDF manipulation with extensive error handling and validation.


📋 Table of Contents


Overview

The PDF Reader Package wraps the powerful Poppler command-line utilities in a clean, Laravel-friendly API. It handles PDF text extraction, HTML conversion, image extraction, and metadata retrieval with built-in validation, security, and error handling.

Why This Package?


Features

Core Functionality

Advanced Features


System Requirements

Required Software

Poppler Binaries

The package requires the following Poppler command-line tools:


Dependencies

Installing Poppler Utilities

Ubuntu/Debian

Verify installation:

macOS

Using Homebrew:

Verify installation:

Windows

  1. Download Poppler for Windows from GitHub Releases
  2. Extract the archive to a permanent location (e.g., C:\Program Files\poppler)
  3. Add the bin directory to your system PATH:
    • Right-click "This PC" → Properties → Advanced system settings
    • Environment Variables → System variables → Path → Edit
    • Add: C:\Program Files\poppler\Library\bin
  4. Restart your terminal/IDE

Verify installation:

Laravel Dependencies

This package uses the following Laravel features:

All dependencies are included in Laravel 10+.


Installation

Step 1: Package Location

This package is located at:

It's already configured in your main composer.json under autoload-dev.

Step 2: Publish Configuration

Publish the package configuration file to your Laravel application:

This creates config/pdf-reader.php with default settings.

Step 3: Configure Binary Paths (Optional)

If Poppler binaries are not in your system PATH, specify full paths in .env:

Windows Example:

Step 4: Create Storage Directories

The package auto-creates these directories when needed, but you can create them manually:


Configuration

Configuration File

The published config/pdf-reader.php file contains:

Configuration Options

Key Default Description
pdftotext_binary pdftotext Path to pdftotext executable
pdftohtml_binary pdftohtml Path to pdftohtml executable
pdfinfo_binary pdfinfo Path to pdfinfo executable
pdfimages_binary pdfimages Path to pdfimages executable

Note: If binaries are in your system PATH, you can use just the binary name. Otherwise, provide the full absolute path.


Usage Guide

Import the Facade

Text Extraction

Basic Text Extraction

Extract all text from a PDF:

Extract Specific Pages

Extract text from pages 1 to 5:

Extract text from a single page:

Keep Output File

By default, temporary files are deleted. To keep them:

Method Signature


HTML Conversion

Basic HTML Conversion

Convert entire PDF to HTML:

Convert Specific Pages

Keep Output File

Method Signature


Image Extraction

Extract All Images

Keep Image Files

Extract from Specific Pages

Save Images to Custom Location

Method Signature


Metadata Retrieval

Get PDF Information

Access Specific Metadata

Method Signature


Exception Handling

The package throws specific exceptions for different error scenarios.

Exception Hierarchy

InvalidPdfException

Thrown when:

BinaryNotFoundException

Thrown when a required Poppler binary is not found:

PdfReaderException

Thrown for general extraction errors:

Complete Exception Handling


Testing

The package includes comprehensive Pest tests.

Run Package Tests

From your Laravel project root:

Test Coverage

The test suite covers:

Example Test Output


Architecture

Package Structure

Service Provider

The PdfReaderServiceProvider registers the service as a singleton:

Facade

The PdfReader facade provides static access:

Service Class

PdfReaderService handles all PDF operations:


Troubleshooting

Binary Not Found

Error: BinaryNotFoundException: The required binary 'pdftotext' was not found

Solutions:

  1. Verify Poppler is installed: which pdftotext (Linux/Mac) or where pdftotext (Windows)
  2. Add binary paths to .env:

  3. Ensure binaries are in system PATH

Permission Denied

Error: InvalidPdfException: The file is not readable

Solutions:

  1. Check file permissions: ls -la /path/to/file.pdf
  2. Ensure web server user has read access:

Invalid PDF

Error: InvalidPdfException: The file is not a valid PDF

Solutions:

  1. Verify file is actually a PDF: file /path/to/file.pdf
  2. Check file isn't corrupted
  3. Ensure file has proper PDF header (%PDF-)

Output Directory Not Created

Error: Permission issues with storage/app/public/pdf-reader

Solutions:

  1. Ensure storage directory is writable:

  2. Create directories manually:

Windows Path Issues

Error: Mixed path separators causing issues

Solution: The package uses DIRECTORY_SEPARATOR for cross-platform compatibility. Ensure you're using the latest version.


Output Files

Storage Locations

When keepFile: true or keepFiles: true, extracted files are saved to:

Type Location
Text storage/app/public/pdf-reader/texts/
HTML storage/app/public/pdf-reader/htmls/
Images storage/app/public/pdf-reader/images/

File Naming Convention

Accessing Saved Files


Best Practices

1. Always Handle Exceptions

2. Validate Input Before Processing

3. Clean Up Temporary Files

4. Use Page Ranges for Large PDFs

5. Configure Binaries in Environment


License

MIT License

Copyright (c) 2024 Shibashish

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of pdf-reader with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/process Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shibashish/pdf-reader contains the following files

Loading the files please wait ...