- What is tecnickcom/tc-lib-pdf-parser used for?
- It is a pure-PHP library that parses raw PDF data into structured PHP arrays for content inspection, metadata extraction, validation, and migration pipelines. It handles cross-reference and object stream parsing plus filter-aware stream decoding. It is not a PDF renderer and does not perform OCR.
- How do I install tc-lib-pdf-parser in a Laravel project?
- Install it with Composer using composer require tecnickcom/tc-lib-pdf-parser. The package requires PHP 8.2 or later and has no Laravel-specific dependencies. In Laravel, bind the parser in a service provider or wrap it in a facade for cleaner dependency injection.
- Which Laravel versions are compatible with tc-lib-pdf-parser?
- The package has no framework-specific dependencies, so it works with any Laravel version running on PHP 8.2 or later. Check your Laravel branch's PHP requirement before installing. You can use it in Laravel 10, Laravel 11, and newer releases that support PHP 8.2+.
- Can tc-lib-pdf-parser extract text and metadata from PDF files?
- It parses PDF structure into arrays suitable for building text and metadata extractors, including titles, authors, and document information when present. It focuses on structural parsing rather than providing a high-level text-layer extraction API. For complex text extraction, you may need custom extractor logic or compare with other tools.
- Does tc-lib-pdf-parser support encrypted or password-protected PDFs?
- No native encrypted PDF support is described, so password-protected files may need preprocessing before parsing. Decrypt the PDF with an appropriate tool or workflow first, then pass the unlocked file to the parser. Validate inputs and handle failures with typed exceptions.
- Can tc-lib-pdf-parser process scanned PDFs or perform OCR?
- No, the library is a PDF parser, not an OCR engine. Scanned image-only PDFs will not produce usable text through parsing alone. Pre-process them with OCR software such as Tesseract before extracting text or metadata.
- How does tc-lib-pdf-parser compare to Symfony PdfParser or pdftotext?
- tc-lib-pdf-parser is lightweight, pure PHP, and needs no external binaries, which simplifies deployment. Symfony PdfParser and pdftotext-based tools may offer more advanced text-layer extraction for search use cases. Benchmark both against your document types before choosing.
- How do I use tc-lib-pdf-parser with Laravel queues and service injection?
- Bind the parser as a singleton or transient service in a Laravel service provider, then inject it into a dedicated PDF parsing service. For large or batch files, dispatch a queued job such as ParsePdfJob and store extracted data in Eloquent models, files, or a search index. Create a fresh parser instance per job because parsing is not thread-safe.
- What are the performance risks of parsing large PDFs with tc-lib-pdf-parser?
- Very large PDFs, especially over 100MB, can cause memory pressure in PHP. Use background queues, validate file size and structure, and consider chunked or stream-oriented workflows where possible. Avoid sharing one parser instance across concurrent processes.
- Is tc-lib-pdf-parser actively maintained and safe for production?
- It is part of the tc-lib-pdf and TCPDF ecosystem, which has very high install counts, and it ships with build and coverage badges, typed exceptions, and tolerant parsing options. The package is low-level and may see less frequent feature work than framework-specific alternatives, so pin a tested version and monitor releases. Write PHPUnit or Pest tests for your own PDF schemas before relying on it in production.