承接 ptsilva/document-counter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ptsilva/document-counter

Composer 安装命令:

composer require ptsilva/document-counter

包简介

A simple document page counter. Works with laravel and out of the box

README 文档

README

This can be used to count the total pages in PDF document

Instalation

 composer require ptsilva/pdf-counter-pages

Need install GhostScript also

Out of the box

$path = '/var/www/html/project/document.php';

$pdf = new \Ptsilva\DocumentCounter\Documents\PDFDocument($path);

$driver = new \Ptsilva\DocumentCounter\PDFGhostScriptCounter('/usr/bin/gs');

$totalPages = $driver->process($pdf);

var_dump($totalPages); // integer

Using Laravel 5

After updating composer, add the ServiceProvider to the providers array in config/app.php

Ptsilva\DocumentCounter\Providers\DocumentCounterServiceProvider::class,

Copy the package config to your local config with the publish command:

php artisan vendor:publish --provider="Ptsilva\DocumentCounter\Providers\DocumentCounterServiceProvider"

Just use

$path = '/var/www/html/project/document.php';

$totalPages = app('document-counter')->getTotalPages(new \Ptsilva\DocumentCounter\Documents\PDFDocument($path));

dd($totalPages); // integer

Or using Dependency Injection

use Ptsilva\DocumentCounter\Factory\DocumentCounterFactory;
use Ptsilva\DocumentCounter\Documents\PDFDocument;
class Controller
{
    public function index(DocumentCounterFactory $counter)
    {
        $path = '/var/www/html/project/document.php';

        $totalPages = $counter->getTotalPages(new PDFDocument($path));

        dd($totalPages); // integer
    }

}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固