承接 indzz/pdfprotect 相关项目开发

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

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

indzz/pdfprotect

Composer 安装命令:

composer require indzz/pdfprotect

包简介

A library to add password protection to an existing PDF file

README 文档

README

This is a PHP wrapper library to add password encryption to an existing PDF file.

Driver 1 - FPDI

The first solution requires PHP only.

It uses FPDI to import all pages of the source PDF and add each page to a new file. Then, it outputs the file binary as a response.

Advantage:

  • PHP Only, no extra library needed

Disadvantage:

  • PDF version 1.5 or above is not supported, due to the limitation of the free PDF parser

Please be reminded to add the following packages to composer.json before you use this driver:

{
  "require": {
    "setasign/fpdi": "^2.0",
    "tecnickcom/tcpdf": "6.3.*"  
  }
}

Driver 2 - QPDF

The second solution uses QPDF, which is a command line program. The solution simply calls shell_exec to execute QPDF and add the password.

Advantage:

  • Simple
  • Supports PDF version 1.5

Disadvantage:

  • Requires extra library installed on the system

For macOS, you may install QPDF with Homebrew:

brew install qpdf

For Ubuntu, you may install with apt:

apt-get install -y qpdf

If you are using other Linux distribution, please refer to the corresponding package repository.

Example

The simplest usage is:

<?php
use INDZZ\PdfProtector\PdfProtector;

PdfProtector::create('fpdi')
    ->source(__DIR__.'/input/1.pdf')
    ->protect('userPw', 'ownerPw')
    ->output();

See example folder for more details

License

This library is open-sourced under the MIT license.

Please also refer to the license of the

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固