Login   Register  
PHP Classes
elePHPant
Icontem

File: example_extension

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of PHP-4-Business  >  WKHTMTOPDF HTML to PDF creator  >  example_extension  >  Download  
File: example_extension
Role: Example script
Content type: text/plain
Description: Example using php extension
Class: WKHTMTOPDF HTML to PDF creator
Convert HTML to PDF using the Webkit engine
Author: By
Last change: formatting
Date: 2 years ago
Size: 1,282 bytes
 

Contents

Class file image Download
<?php

    
/*  $headerhtml & $footerhtml will be repeated on each page  */
    /* ********************************************************* */
    
    
$headerhtml '<html><head></head><body><table width="100%" border="0"><tr><td width="100%"><img src="' $_SERVER['HTTP_HOST'] . '/logo.png" /><span style="float:right;font-size:12px">Some Text</span></td></tr></table></body></html>';

    
$footerhtml '<html><head></head><body><table width="100%" border="0"><tr><td width="100%" style="text-align:center;font-size:10px;color:blue;">1 Anystreet, Anytown, Anycounty&nbsp;&nbsp;&nbsp;tel: 01234 567890&nbsp;&nbsp;&nbsp;mail@address.co.uk</td></tr></table></body></html>';

    
$wkhtmloptions['global'] = array( 'colorMode' => 'grayscale''margin.top' => '15mm' );
    
$wkhtmloptions['object'] = array( 'header.spacing' => '5mm''footer.spacing' => '2mm' );

    
$pdf = new wkhtmltopdf(array(    
            
'title'         => 'Title',
            
'html'          => 'Content',
            
'tmppath'       => $_SERVER['DOCUMENT_ROOT'].'tmp',
            
'header_html'   => $headerhtml,
            
'footer_html'   => $footerhtml,
            
'options'       => $wkhtmloptions,
            ) ,
'php');
            
    
$pdf->output('I''document.pdf');
?>