[GRLUG] "Time Stamp" PDF

Justin Denick justin.denick at gmail.com
Fri May 6 11:17:40 EDT 2016


fpdf will let you use an existing PDF as a background image.
here a snippet that could get better with a few refactors.
not sure how you're reading in the DOC# and DESC

#!/bin/someshell

cd to the dir
for files in `ls` {
  php this-script.php?FILE=$file&DOC=2&DESC=Spaces+Will+Be+A+Problem
}

<?php
require_once('fpdf.php');
require_once('fpdi.php');
//populate vars using GET
class PDF extends FPDI {
function Footer() {
 $this->SetY(-15);
 $this->SetFont('Arial','I',8);
 $this->Cell(0,10,'Page '.$this->PageNo().$_GET[DOC].$GET[DESC],0,0,'C');
 $this->ln(10); //adjust to taste
 $this->Cell(0,10,$_GET[DOC].' -- '.$_GET[DESC],0,0,'C');
}
}

$pdf = new PDF();

$pageCount = $pdf->setSourceFile("friend-attorney-doc.pdf");
$tplIdx = $pdf->importPage(1, '/MediaBox');
$pdf->addPage();
$pdf->useTemplate($tplIdx, 10, 10, 90);
$pdf->Output($_GET[FILE].'-v2');

?>

On Fri, May 6, 2016 at 10:28 AM L. V. Lammert <lvl at omnitec.net> wrote:

> Interesting question from a friend attorney, .. he wants to put a footer
> on a PDF document with case #, description, page x of n.
>
> Before I create a template in gimp [so it can be done semi-transparent],
> can anyone think of a better solution?
>
> Do NOT wish to edit the PDF, .. so LibreOffice or InkScape would not be
> desirable.
>
>         Thanks!
>
>         Lee
>
> _______________________________________________
> grlug mailing list
> grlug at grlug.org
> http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug

-- 
🌿
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shinobu.grlug.org/pipermail/grlug/attachments/20160506/4dcc4bab/attachment.html>


More information about the grlug mailing list