agussaputrapro/ocrmypdf 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

agussaputrapro/ocrmypdf

Composer 安装命令:

composer require agussaputrapro/ocrmypdf

包简介

A simple PHP wrapper for OCRmyPDF

README 文档

README

A simple PHP wrapper for OCRmyPDF

Installation

Via Composer:

$ composer require mishagp/ocrmypdf

This library depends on OCRmyPDF. Please see the GitHub repository for instructions on how to install OCRmyPDF on your platform.

Usage

Basic example

use mishagp\OCRmyPDF\OCRmyPDF;

//Return file path of outputted, OCRed PDF
echo (new OCRmyPDF('document.pdf'))->run();

//Return file contents of outputted, OCRed PDF
echo (new OCRmyPDF('scannedImage.png'))->setOutputPDFPath(null)->run();

API

This section is a work-in-progress.

setInputData

Pass image/PDF data loaded in memory into ocrmypdf directly via stdin.

use mishagp\OCRmyPDF\OCRmyPDF;

//Using Imagick
$data = $img->getImageBlob();
$size = $img->getImageLength();

//Using GD
ob_start();
imagepng($img, null, 0);
$size = ob_get_length();
$data = ob_get_clean();

echo (new OCRmyPDF())
    ->setInputData($data, $size)
    ->run();

setOutputPDFPath

Specify a writable path where ocrmypdf should generate output PDF.

use mishagp\OCRmyPDF\OCRmyPDF;
echo (new OCRmyPDF('document.pdf'))
    ->setOutputPDFPath('/outputDir/ocr_document.pdf')
    ->run();

setExecutable

Define a custom location of the ocrmypdf executable, if by any reason it is not present in the $PATH.

use mishagp\OCRmyPDF\OCRmyPDF;
echo (new OCRmyPDF('document.pdf'))
    ->setExecutable('/path/to/ocrmypdf')
    ->run();

License

ocrmypdf-php is released under the AGPL-3.0 License.

Credits

Development of ocrmypdf-php is based on the tesseract-ocr-for-php PHP wrapper library for tesseract developed by thiagoalessio and associated contributors.

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-only
  • 更新时间: 2022-02-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固