承接 uvinum/pdf-watermarker 相关项目开发

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

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

uvinum/pdf-watermarker

最新稳定版本:1.0.3

Composer 安装命令:

composer require uvinum/pdf-watermarker

包简介

Simple PDF Watermarker

README 文档

README

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

Installing using composer

> composer require binarystash/pdf-watermarker:^2.0

Usage

<?php

use BinaryStash\PdfWatermarker\Pdf;
use BinaryStash\PdfWatermarker\Watermark;
use BinaryStash\PdfWatermarker\FpdiPdfWatermarker as PDFWatermarker;

// Specify path to the existing pdf
$pdf = new Pdf('my.pdf');

// Specify path to image. The image must have a 96 DPI resolution.
$watermark = new Watermark('watermark.png'); 

// Create a new watermarker
$watermarker = new PDFWatermarker($pdf, $watermark); 
 
// Save the new PDF to its specified location
$watermarker->savePdf('output.pdf');

?>

Options

<?php

use BinaryStash\PdfWatermarker\Position;

// Set the position of the watermark
// All possible positions can be found in Position::options
$watermarker->setPosition(new Position('BottomCenter'));

// Alternatively
$watermarker->setPosition(Position::BottomCenter());

// Place watermark behind original PDF content. Default behavior places it over the content.
$watermarker->setAsBackground();

// Only Watermark specific range of pages
// This would only watermark page 3 and 4
$watermarker->setPageRange(3, 4);

?>

Output Options

<?php

// The filename is optional for all output options
$watermarker->savePdf();

// Start a download of the PDF
$watermarker->downloadPdf('output.pdf');

// Send the PDF to standard out
$watermarker->stdOut('output.pdf');

?>

Support

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

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 4
  • Forks: 63
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-29