How to display FPDF with JUI TABS

hello master, I have created a code like this :

in view




<?php 

$this->widget('zii.widgets.jui.CJuiTabs', array(

	'tabs'=>array(

		'Data Pasient'=>array(

			'ajax'=>$this->createUrl('viewPatient', array('id'=>$id))

		),

		'Pendaftaran'=>array(

			'ajax'=>$this->createUrl('newAddmission',array('id'=>$id, 'type'=>$type)),

		),

		'Kartu Pasien'=>array(

                        // link with problem ...!

			'ajax'=>$this->createUrl('patientCard',array('id'=>$id), true, true)

		),

	),

	'options'=>array(

		'collapsible' => true,

	),

));

?>



controller




public function actionPatientCard($id)

	{

		$patient = $this->loadPatient($id);

		// set card

		$pdf = new PDF_Code128('L','mm',array(100,155));

		$pdf->AddPage();

		$pdf->SetFont('Arial','',10);

		$pdf->Code128(11,30,$patient->no_rm,30,15);

		$pdf->Write(30,'No RM : '.$patient->no_rm);

		$pdf->Output();

	}



the problem is that this is the code I can not see the card view in pdf format, the show is a chaotic code like this picture2338

tab.jpg

if i display directly url like this


http://localhost/simrs/index.php/outpatientAdmission/patientCard?id=1 

then I’ll get the results like this picture 2341

card.jpg

please help me to solve this problem

Yeah, you can’t insert a PDF into a (X)HTML document just like that. You’ll need at least an iframe for that. Are you just caring for the barcode? If so, PEAR::Image_Barcode is perfectly fine for that.

Actually… screw that. It should be sufficient to add the following line just before $pdf->Output();




header('Content-Type: application/pdf');



where I should put image_barcode

Image_Barcode same with code128, Code128 is extend from fpdf, may be is same with image barcode .

the code below is not work


header('Content-Type: application/pdf');

the result in Jui Tabs is same with before…!

Hm, try to add this as well:




header('Content-Disposition: inline');



Last time I used Image_Barcode, I installed it system-wide via PEAR and loaded it with require_once(), which wasn’t the clean way to do it. The Yii guide shows you how to do this correctly.

my main problem is this




<?php 

$this->widget('zii.widgets.jui.CJuiTabs', array(

        'tabs'=>array(

                'Data Pasient'=>array(

                        'ajax'=>$this->createUrl('viewPatient', array('id'=>$id))

                ),

                'Pendaftaran'=>array(

                        'ajax'=>$this->createUrl('newAddmission',array('id'=>$id, 'type'=>$type)),

                ),

                'Kartu Pasien'=>array(

                        // link with problem ...!

                        'ajax'=>$this->createUrl('patientCard',array('id'=>$id), true, true)

                ),

        ),

        'options'=>array(

                'collapsible' => true,

        ),

));

?>



may be you have solution in line code below




'Kartu Pasien'=>array(

                        // link with problem ...!

                        'ajax'=>$this->createUrl('patientCard',array('id'=>$id), true, true)

                ),



becouse if i’m direct url, i get success barcode and it can display in browser

anyone can help me??

ahmadroni, can you explain what you would like to achieve? Do you just want to print or display barcodes?