Estoy generando un pdf con la librería tcpdf pero deseo crear un encabezado con una altura, titulo y imagen diferente a la que viene en esta, en realidad no se mucho sobre esta libreria y no comprendo algunas cosas, tengo lo siguiente:
// Include the main TCPDF library (search for installation path).
require_once('PDF/tcpdf.php');
//
class PDF{
private $pdf;
function __construct($titulo){
$this->pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information NOTA: datos solo informativos no muestra
$this->pdf->SetCreator(PDF_CREATOR);
$this->pdf->SetAuthor('Personal');
// $this->pdf->SetTitle($Titulo);
// $this->pdf->SetSubject($Asunto);
//$this->pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// Header los parametros PDF_HEADER_LOGO y PDF_HEADER_LOGO_WIDTH se encuentran declarados en config/tcpdf_config.php
// $ln (string) header image logo
// $lw (string) header image logo width in mm
// $ht (string) string to print as title on document header
// $hs (string) string to print on document header
// $tc (array) RGB array color for text.
// $lc (array) RGB array color for line.
// set default header data
$this->pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, $hs=$titulo);
// set header and footer fonts
$this->pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$this->pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$this->pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$this->pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$this->pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$this->pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/spa.php')) {
require_once(dirname(__FILE__).'/lang/spa.php');
$this->pdf->setLanguageArray($l);
}
}
function estructuraPag($contenidoHTML){
// Seleccionamos la tipografia y tamano de letra
$this->pdf->SetFont('dejavusans', '', 10);
// Comienza la pag
$this->pdf->AddPage();
// Contenido pdf
$contenidoHTML;
$this->pdf->writeHTML($contenidoHTML, true, false, true, false, '');
// reset pointer to the last page
$this->pdf->lastPage();
}
function generarPdf($file, $name){
//$file = '../archivos/actas/'.$idContrato;
if(!is_dir($file))
{
if(!mkdir($file, 0777)){
echo "error";
exit();
}
}
// Close and output PDF document
// I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
// D: send to the browser and force a file download with the name given by name.
// F: save to a local server file with the name given by name.
// S: return the document as a string (name is ignored).
// FI: equivalent to F + I option
// FD: equivalent to F + D option
// E: return the document as base64 mime multi-part email attachment (RFC 2045)
$this->pdf->Output($file.'/'.$name.'.pdf', 'FI');
exit();
}
}
aqui algunos ejemplos,