[eluser]smash120[/eluser]
I am using tcpdf to create barcodes. This works fine, the only issue I am having is when the page is rendered the page title says Error instead of the title that I have named it. It will dsiplay the pdf if I send it to a view or not and either way the title will not display. What do I need to do to fix this issue?
This is using one of the examples on the tcpdf site for testing. As I said before it will render the pdf and barcode whether I load the views or not. I also have the route configured and it will work even if I dont write the route statement. Either way the page title says error
Code:
$this->load->library('Pdf');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('DrZ');
$pdf->SetTitle('Prescription Labels');
$pdf->SetSubject('Prescription Labels');
$pdf->SetKeywords('Labels, PDF, DrZ, Patients');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray('english');
// ---------------------------------------------------------
// set a barcode on the page footer
$pdf->setBarcode(date('Y-m-d H:i:s'));
// set font
$pdf->SetFont('helvetica', '', 11);
// add a page
$pdf->AddPage();
// print a message
$txt = "You can also export 1D barcodes in other formats (PNG, SVG, HTML). Check the source code documentation of TCPDFBarcode class for further information.";
$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false);
$pdf->SetY(30);
// -----------------------------------------------------------------------------
// define barcode style
$style = array(
'position' => '',
'align' => 'C',
'stretch' => false,
'fitwidth' => true,
'cellfitalign' => '',
'border' => true,
'hpadding' => '1',
'vpadding' => '1',
'fgcolor' => array(0, 0, 0),
'bgcolor' => false, //array(255,255,255),
'text' => true,
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4
);
// PHARMACODE
$pdf->Cell(0, 0, 'PHARMACODE', 0, 1);
$pdf->write1DBarcode('789', 'PHARMA', '', '', '', 18, 0.4, $style, 'N');
$pdf->Ln();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('drz_labels.pdf', 'I');
//$data['title'] = 'PDF';
//$data['pdf'] = $pdf->Output('example_027.pdf', 'I');
//$this->load->view('templates/header',$data);
//$this->load->view('main_site/create_pdf',$data);
//$this->load->view('templates/footer');