Skip to content
BinaryStash edited this page May 24, 2016 · 8 revisions

PDFWatermarker

pdfwatermarker.php

This class applies PDFWatermark to the file

  • Class name: PDFWatermarker
  • Namespace:

Properties

$_originalPdf

private mixed $_originalPdf
  • Visibility: private

$_newPdf

private mixed $_newPdf
  • Visibility: private

$_tempPdf

private mixed $_tempPdf
  • Visibility: private

$_watermark

private mixed $_watermark
  • Visibility: private

$_specificPages

private mixed $_specificPages
  • Visibility: private

Methods

\PDFWatermarker::__construct()

void PDFWatermarker::\PDFWatermarker::__construct()($originalPdf, $newPdf, mixed $watermark)

Creates an instance of the watermarker

  • Visibility: public

Arguments

  • $originalPdf mixed
  • $newPdf mixed
  • $watermark mixed - Watermark - watermark object

\PDFWatermarker::_validateAssets()

void PDFWatermarker::\PDFWatermarker::_validateAssets()()

Ensures that the watermark and the PDF file are valid

  • Visibility: private

\PDFWatermarker::_updatePDF()

void PDFWatermarker::\PDFWatermarker::_updatePDF()()

Loop through the pages while applying the watermark

  • Visibility: private

\PDFWatermarker::_getTotalPages()

mixed PDFWatermarker::\PDFWatermarker::_getTotalPages()()
  • Visibility: private

\PDFWatermarker::_importPage()

void PDFWatermarker::\PDFWatermarker::_importPage()(integer $page_number)

Import page

  • Visibility: private

Arguments

  • $page_number integer - page number

\PDFWatermarker::_watermarkPage()

void PDFWatermarker::\PDFWatermarker::_watermarkPage()(integer $page_number, boolean $watermark_visible)

Apply the watermark to a specific page

  • Visibility: private

Arguments

  • $page_number integer - page number
  • $watermark_visible boolean - (optional) Make the watermark visible. True by default.

\PDFWatermarker::_calculateWatermarkCoordinates()

array PDFWatermarker::\PDFWatermarker::_calculateWatermarkCoordinates()(integer $wWidth, integer $wHeight, integer $tWidth, $tHeight)

Calculate the coordinates of the watermark's position

  • Visibility: private

Arguments

  • $wWidth integer - watermark's width
  • $wHeight integer - watermark's height
  • $tWidth integer - page width
  • $tHeight integer - page height

\PDFWatermarker::setPageRange()

void PDFWatermarker::\PDFWatermarker::setPageRange()(integer $startPage, integer $endPage)

Set page range

  • Visibility: public

Arguments

  • $startPage integer - the first page to be watermarked
  • $endPage integer - (optional) the last page to be watermarked

\PDFWatermarker::savePdf()

void PDFWatermarker::\PDFWatermarker::savePdf()()

Save the PDF to the specified location

  • Visibility: public