binarystash/pdf-watermarker 问题修复 & 功能扩展

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

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

binarystash/pdf-watermarker

最新稳定版本:1.1.2

Composer 安装命令:

composer require binarystash/pdf-watermarker

包简介

Watermark or stamp PDF documents

README 文档

README

Build Status

PDF Watermarker

PDFWatermarker enables you to add an image as a watermark to existing PDF files. It uses FPDF that allows you to write PDF files and FPDI that allows you to import existing PDF documents into FPDF.

Using it, you can:

  • Use jpg and png ( with alpha channels ) files with a 96 DPI resolution
  • Easily position the watermark on the pages of the PDF file

Installation

  1. Place composer.phar in the folder you extracted the files to.

  2. Run php composer.phar install

  3. Include the files in your project.

<?php require_once('pdfwatermarker/pdfwatermarker.php'); require_once('pdfwatermarker/pdfwatermark.php');

Usage

<?php //Specify path to image. The image must have a 96 DPI resolution. $watermark = new PDFWatermark('C:\myimage.png'); //Set the position $watermark->setPosition('bottomleft'); //Place watermark behind original PDF content. Default behavior places it over the content. $watermark->setAsBackground(); //Specify the path to the existing pdf, the path to the new pdf file, and the watermark object $watermarker = new PDFWatermarker('C:\test.pdf','C:\output.pdf',$watermark); //Set page range. Use 1-based index. $watermarker->setPageRange(1,5); //Save the new PDF to its specified location $watermarker->savePdf(); ?>

Five positions can be used. 'center' is the default.

  • center
  • topleft
  • topright
  • bottomright
  • bottomleft

See the API Documentation for more details.

Support

Report bugs at https://github.com/binarystash/pdf-watermarker/issues.

统计信息

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

GitHub 信息

  • Stars: 82
  • Watchers: 9
  • Forks: 63
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固