<?php
header('Content-Type: text/html; charset=UTF-8');
require ('fpdf/fpdf.php');
date_default_timezone_set("America/La_Paz");
include "core/autoload.php";
include "core/app/model/PersonData.php";
require_once('phpqrcode/qrlib.php');

class PDF extends FPDF
{
	function Header()
	{
		
		//Logo
		$this->SetAlpha(1);
		$this->Image('cridai_.jpg', 8, 8,200, 260);
		$this->SetAlpha(1);

		//Arial bold 15
		$this->SetFont('Arial','B',10);
		//Movernos a la derecha
		$this->Cell(80);
		$this->Image('logo.jpeg', 152, 6, 25, 25, 'jpeg');
		//T�tulo
		$this->Cell(30,10,'CRIDAI ORURO - PROCESO DE ADMISION',0,1,'C');
		$this->Cell(30,10,'',0,1,'C');
		//Salto de l�nea
	}
}

	$persons = PersonData::getAll();
	$pdf  = new PDF('P', 'mm', 'letter');
	foreach($persons as $p){
		$pdf->AddPage();
		$qr_ = $p->id.'|'.$p->cd_id.'|'.$p->ci.'|'.$p->name.'|'.$p->type;
		QRcode::png($qr_,"qr".$p->id.".png");
		$pdf->Image('qr'.$p->id.'.png', 20, 20, 35, 35, 'png');
		
		$pdf->Ln(17);
		$pdf->Cell(50);
		$pdf->SetFont('Arial','B',25);
		$pdf->Cell(10 ,5,$p->cd_id,0,0);
		$pdf->SetFont('Arial','B',10);
		$pdf->Cell(30);
		$pdf->Cell(50 ,5,'FIRMA NOTARIO',0,0);
		$pdf->Cell(50 ,5,'FIRMA POSTULANTE',0,1);

	}
$pdf->Output();