Skip to content

stewartmegaw/pdf-watermarker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

PDF Watermarker

PDFWatermarker is a PHP class that 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 this plugin, you can:

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

Installation

Include the files in your project.

<?php
require_once('fpdf/fpdf.php');
require_once('fpdi/fpdi.php');
require_once("pdfwatermarker/*");

Usage

<?php

//Specify path to image
$watermark = new PDFWatermark('C:\myimage.png'); 
 
//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 the position
$watermarker->setWatermarkPosition('bottomleft');
 
//Save the new PDF to its specified location
$watermarker->watermarkPdf(); 
?>

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

  • center
  • topleft
  • topright
  • bottomright
  • bottomleft

Support

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

About

Adds image watermarks to PDF files

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 58.8%
  • HTML 40.8%
  • Other 0.4%