Watermark for PDFs

Phoca Restaurant Menu - restaurant menu manager
BradC
Phoca Member
Phoca Member
Posts: 25
Joined: 22 Aug 2009, 05:14

Watermark for PDFs

Post by BradC »

I found on the TCPDF.org website the code to add watermarks to PDF output.

I added the following to \plugins\phocapdf\restaurantmenu.php at line 187

Code: Select all

$auto_page_break = $this->AutoPageBreak;
$this->SetAutoPageBreak(true, 0); 
$img_file = K_PATH_IMAGES.'J.gif';
$this->Image($img_file, $x=0, $y=121, $w=150, $h=176, $type='', $link='', $align='', $resize=false, $dpi=72, $palign='', $ismask=false, $imgmask=false, $border=0); 
$this->SetAutoPageBreak($auto_page_break);
See example here http://www.junctionmotel.com.au/wine-list

However as you can see in the Wine List PDF the margin bottom parameter is now not being applied.

Taken from TCPDF element index
SetAutoPageBreak(true, 0)
Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
If I set the second parameter in SetAutoPageBreak to anything other 0, it fails big time.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
The ability to add watermarks would be a nice feature
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Watermark for PDFs

Post by Jan »

Hi, thank you for this guide, I will take a look at it,

added into a feature request list.

Jan
If you find Phoca extensions useful, please support the project
Post Reply