ibnuhalimm/laravel-pdf-to-html 问题修复 & 功能扩展

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

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

ibnuhalimm/laravel-pdf-to-html

最新稳定版本:v1.2.1

Composer 安装命令:

composer require ibnuhalimm/laravel-pdf-to-html

包简介

Laravel Wrapper to Convert PDF to HTML

README 文档

README

Latest Version on Packagist Total Downloads

Convert PDF to HTML by using pdftohtml on Your Laravel Apps. Special thanks to pdf-to-text (Spatie) package for inspiring this package.

Contents

Requirements

Behind the scene this package leverages pdftohtml. You can verify if the binary installed on your system by executing this command.

which pdftohtml

If it doesn't return the installed path of the binary, you can install the binary using the following command.

  • Ubuntu and Debian family
apt-get install poppler-utils
  • CentOS, Fedora, and RedHat family
yum install poppler-utils
  • Mac using brew
brew install poppler

Installation

You can install the package via composer:

composer require ibnuhalimm/laravel-pdf-to-html

Setting Up

Optionally, you can set the config in your .env file:

PDF_TO_HTML_PATH="/usr/bin/pdftohtml"
PDF_TO_HTML_OUTPUT_DIR="/var/www/html/app/public"
PDF_TO_HTML_INLINE_IMAGES=true

Usage

Set the file and get result

use Ibnuhalimm\LaravelPdfToHtml\Facades\PdfToHtml;

$sourceFile = '/path/to/your-file.pdf';
PdfToHtml::setFile($sourceFile)->result();

// It will return output file path
// e.g. : /var/www/html/storage/app/pdf-to-html/your-file.html

Save as the result file

use Ibnuhalimm\LaravelPdfToHtml\Facades\PdfToHtml;

$sourceFile = '/path/to/your-file.pdf';
PdfToHtml::setFile($sourceFile)
    ->saveAs('result-file')
    ->result();

// It will return output file path as
// e.g. : /var/www/html/storage/app/pdf-to-html/result-file.html

We can set config on-the-fly

use Ibnuhalimm\LaravelPdfToHtml\Facades\PdfToHtml;

$sourceFile = '/path/to/your-file.pdf';
PdfToHtml::setFile($sourceFile)
    ->setConfig([
        'bin_path' => '/usr/local/bin/pdftohtml',
        'output_dir' => public_path('/new-location'),
        'inline_images' => false
    ])
    ->result();

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ibnuhalim@pm.me instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-08