承接 csoellinger/xpdf-cli-pdfinfo 相关项目开发

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

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

csoellinger/xpdf-cli-pdfinfo

最新稳定版本:v1.1.2

Composer 安装命令:

composer require csoellinger/xpdf-cli-pdfinfo

包简介

A little PHP wrapper around the Xpdf cli tool: pdfinfo.

README 文档

README

A little PHP wrapper around the Xpdf cli tool: pdfinfo.

Fetching the following informations and make them easy accessible:

  • Producer
  • Creation date
  • Modified date
  • Tagged
  • Form
  • Pages
  • Encrypted
  • Page size
    • Width as points
    • Height as points
    • Format
    • Rotated Degrees
  • Box (Media, Crop, Bleed, Trim, Art)
    • X coordinate as points
    • Y coordinate as points
    • Width as points
    • Height as points
  • File size
    • Bytes
  • Optimized
  • PDF version

Note: If you have a password protected pdf file, and not setting the password param, you will get a process failed exception.

Getting Started

PHP 7 or above and Composer is expected to be installed on your system.

Installing

composer require csoellinger/xpdf-cli-pdfinfo 

Usage

<?php use XpdfCliTools\PdfInfo\PdfInfo; use XpdfCliTools\PdfInfo\Model\PdfInfoModel; $pdfInfo = new PdfInfo(); // Optionally set a custom path to pdfinfo binary file: // $pdfInfo = new PdfInfo('<Path-To-Binary>'); /** @var PdfInfoModel $info */ $info = $pdfInfo->exec('<Path-To-Pdf>.pdf'); // If you have a passwort protected pdf file: // $info = $pdfInfo->exec('<Path-To-Pdf>.pdf', 'OwnerPassword'); // $info = $pdfInfo->exec('<Path-To-Pdf>.pdf', null, 'UserPassword'); // Access the pdf informations echo $info->Creator; // Creator echo $info->Producer; // Producer echo $info->CreationDate; // Creation date echo $info->ModDate; // Modification date echo $info->Tagged; // Tagged (true/false) echo $info->Form; // Form(s) echo $info->Pages; // Number of pages echo $info->PageSize->Width; // Page width as points echo $info->PageSize->Height; // Page height as points echo $info->PageSize->Format; // Page format (if found) echo $info->PageSize->RotatedDegrees; // Degrees if rotated echo $info->PageSize->raw; // Raw shell output for page size // Available boxes: MediaBox, CropBox, BleedBox, TrimBox, ArtBox echo $info->MediaBox->X; // X coordinate echo $info->MediaBox->Y; // Y coordinate echo $info->MediaBox->Width; // Box width as points echo $info->MediaBox->Height; // Box height as points echo $info->MediaBox->raw; // Raw shell output for box echo $info->FileSize->Bytes; // File size in bytes echo $info->FileSize->raw; // Raw shell output for file size echo $info->Encrypted; // Encrypted (true/false) echo $info->Optimized; // Optimized (true/false) echo $info->PDFVersion; // Version echo $info->raw; // Raw shell output from pdfinfo // Get page size as millimeter: echo $info->PageSize->Width / PdfInfo::MM_TO_PTS; // = Convert points to millimeter echo $info->PageSize->Height / PdfInfo::MM_TO_PTS; // = Convert points to millimeter

Example

See inside public dir for an example.

Running the Tests

All tests can be run by executing

vendor/bin/phpunit 

phpunit will automatically find all tests inside the tests directory and run them based on the configuration in the phpunit.xml file.

Running the Example

PHP has an in-built server for local development. To run this change into the directory public and run

php -S localhost:8000 

Then open your browser at http://localhost:8000/example.php

Built With

ToDo

  • Add different encrypted informations: Encrypted: yes (print:yes copy:yes change:yes addNotes:yes)

License

This project is licensed under the MIT License - see the LICENCE.md file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固