public function create_pdf_oferte($title, $desc, $products) { $CI =& get_instance(); $CI->load->helper('tfpdf'); $CI->load->helper('data_helper'); $CI->load->model('mysql'); $CI->load->library('session'); $pdf = new tFPDF('P', 'mm', 'A4'); $pdf->AddPage(); //titlu oferta // Add a Unicode font (uses UTF-8) $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true); $pdf->SetFont('DejaVu', '', 14); //$pdf->AddFont('TimesNewRomanPSMT','','times.php'); //$pdf->SetFont('TimesNewRomanPSMT',''); // $pdf->AddFont('TimesNewRomanPSMT','','times.php'); // $pdf->SetFont('TimesNewRomanPSMT','',12); // $pdf->SetFont('Arial','B',16); $pdf->Cell(0, 0, $title); $pdf->Ln(5); // rind nou //descrire oferta $pdf->MultiCell(0, 5, $desc); $pdf->Ln(5); $i = 0; foreach ($products as $item) { $i++; //info suprafata $pdf->SetFont('Arial', 'B', 11); $pdf->Cell(0, 0, 'Info Suprafata publicitara Nr' . $i); $pdf->Ln(8); // rind nou //adresa link $pdf->SetTextColor(0, 136, 204); $pdf->SetFont('Arial', 'B', 11); $pdf->Cell(0, 0, $item['adresa'], '', '', '', false, 'http://www.marplo.net/jocuri'); $pdf->Ln(5); // rind nou //numar de inventar $pdf->SetFont('Arial', '', 10); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(0, 0, 'Numarul de inventar: #' . $item['inv']); $pdf->Ln(8); // rind nou //pret $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(0, 0, 'Pret: ' . $item['price'] . ' euro'); $pdf->Ln(10); // rind nou //dimensiunea $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(0, 0, 'Dimensiuni: ' . $item['format']); $pdf->Ln(5); // rind nou //foto if ($item['image'] and file_exists($_SERVER['DOCUMENT_ROOT'] . $item['image'])) { $pdf->Cell(0, 0, 'Foto'); $pdf->Ln(2); // rind nou $pdf->Image('.' . $item['image']); $pdf->Ln(20); // rind nou } else { $pdf->Ln(20); } // rind nou } //footer $pdf->SetFont('Arial', 'B', 6); $pdf->Cell(0, 0, 'Trendseter Copyright 2011', '', '', 'C'); $pdf->Ln(5); // rind nou // Tilte pdf $page_title = 'Oferta_' . date('d_m_Y_H:i:s'); $pdf->output('./uploads/offerts/' . $page_title . '.pdf', 'F'); $CI->mysql->insert('offerts_pdf', array('uid' => $CI->session->userdata('uid'), 'pdf' => './uploads/offerts/' . $page_title . '.pdf')); return './uploads/offerts/' . $page_title . '.pdf'; }