CodeIgniter Forums

Full Version: Error for page title
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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

// create new PDF document

// set document information
$pdf->SetTitle('Prescription Labels');
$pdf->SetSubject('Prescription Labels');
$pdf->SetKeywords('Labels, PDF, DrZ, Patients');

// set default header data

// 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

//set margins

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor

//set some language-dependent strings

// ---------------------------------------------------------
// 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

// 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);

// -----------------------------------------------------------------------------

// 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');


        // ---------------------------------------------------------
        //Close and output PDF document  
        $pdf->Output('drz_labels.pdf', 'I');      
        //$data['title'] = 'PDF';
        //$data['pdf'] = $pdf->Output('example_027.pdf', 'I');

El Forum

How can someone answer that without seeing your code?