Laravel Packages

Laravel SpaceOCR: Parse Images and Multi-page PDFs in Laravel

Published
Laravel SpaceOCR: Parse Images and Multi-page PDFs in Laravel image

The Laravel OCR Space package integrates with the OCRSpace API to provide a simple way to parse images and multi-page documents into JSON using Optical Character Recognition. Once you configure this package, you can use the provided OcrSpace service to interact with the API:

use Codesmiths\LaravelOcrSpace\OcrSpaceOptions;
use Codesmiths\LaravelOcrSpace\Facades\OcrSpace;

OcrSpace::parseImageFile(
    'path/to/image.jpg'
    OcrSpaceOptions::make(),
);

OcrSapce::parseImageUrl(
    $imageUrl,
    OcrSpaceOptions::make(),
);

OcrSpace::parseBase64Image(
    $base64Image,
    OcrSpaceOptions::make(),
);

OcrSpace::parseBinaryImage(
    $binaryImage,
    $options,
);

Using the API, you might get something like the following example back from the OCRSpace API in JSON format:

{
    "ParsedResults":
    [
        {
            "TextOverlay":
            {
                "Lines":
                [],
                "HasOverlay": false,
                "Message": "Text overlay is not provided as it is not requested"
            },
            "TextOrientation": "0",
            "FileParseExitCode": 1,
            "ParsedText": "ELLIOT\r\n29 Comments f Facebook Twitter G* Google O Pinterest in LinkedIn 6 Reddit\r\nLockheed's I-J-2S spy planes are famously difficult to launch and land....",
            "ErrorMessage": "",
            "ErrorDetails": ""
        }
    ]
}

You can learn more about this package, get full installation instructions, and view the source code on GitHub. This package requires an ORCSpace API account, which you can learn more about from the documentation. They have a free tier and various paid accounts with more features, such as larger file sizes, PDF page limits, and an SLA of 100% uptime.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Generate Laravel Validation Rules From a JSON Schema image

Generate Laravel Validation Rules From a JSON Schema

Read article
Laravel Suspicious Login: Detect and Block Risky Logins image

Laravel Suspicious Login: Detect and Block Risky Logins

Read article
Decide with Jev: Make Failed AI Requests Safe in Laravel image

Decide with Jev: Make Failed AI Requests Safe in Laravel

Read article
Black Friday: Learn the habits behind AI workflows that work image

Black Friday: Learn the habits behind AI workflows that work

Read article
Laravel Black Friday and Cyber Monday Deals 2026 image

Laravel Black Friday and Cyber Monday Deals 2026

Read article
pgjumbo: A PostgreSQL Client for macOS, Windows, and Linux image

pgjumbo: A PostgreSQL Client for macOS, Windows, and Linux

Read article