• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hi guys is it possible to style your text while wrttting a pdf file using fpdi library

#1
[eluser]Waqar[/eluser]
I need help is it possibile to use stylesheet in controller to style the text to write pdf file using fpdi library? here is my source code i want to be able to style the text
because i need to enter the text into blocks in pdf file. how can i use stylesheet to style the text and write on pdf file

Code:
function form_a()
        {
            if($this->uri->segment(3))
            {
                $id=$this->uri->segment(3);
        
                $data['row'] = $this->tpc_model->retrieve($id);
            }
                foreach($data as $obj)
                {
                
                //$mypdf = new fpdi();
                    $pdf =& new FPDI('P','mm','A4');
                     define('FPDF_FONTPATH',$this->config->item('fonts_path'));
                    //$pdf = new fpdi();
                    
                    //$f= $obj->firstname;
                    $name= strtoupper($obj->firstname);;
                    function expand_string($name)
                    {
                        $new_name='';
                    
                        for($i=0;  $i < strlen($name); $i++)
                        {
                            $new_name.= $name[$i].' ';
                            
                        }
                        return $new_name;
                    }
                    
                    $myname = expand_string($name);
                    $address =  strtoupper($obj->postal_address);
                    $postal_add = expand_string($address);
                    //$postal_address = strtoupper($obj->postal_address);
                    $res_address = strtoupper($obj->res_address);
                    $res_add =expand_string($res_address);
                    
                    $postal_address = strtoupper($obj->postal_code);
                    $p_address = expand_string($postal_address);
                    $post_code = strtoupper($obj->postcode);
                    $postalcode =  expand_string($post_code);
                    $magistrial = strtoupper($obj->magistrial_dist);
                    $magist = expand_string($magistrial);
                    $lang = strtoupper($obj->language);
                    $language_speak = expand_string($lang);
                    $initial = strtoupper($obj->initials);
                    $newinitial = expand_string($initial);
                    $cell_num = strtoupper($obj->cell);
                    $cellular = expand_string($cell_num);
                    $married = $obj->married_in;
                    if($married == 1){
                    $married_in = strtoupper('X');
                    }
                    else
                    {
                    $married_in ='';
                    }
                    $id_number = ($obj->id_num);
                    $pdf->AddPage();
                               $pdf->setSourceFile(BASEPATH.'pdfs/persononal_info.pdf');
                    $tplIdx = $pdf->importPage(1);
                    $pdf->useTemplate($tplIdx, 1, 1, 210);
                    $pdf->SetFont('Courier','B');
                    $pdf->SetFontSize('10');
                    $pdf->SetTextColor(0,0,0);
                    $pdf->SetXY(51, 85);
                    $pdf->Write(0, ''.$myname.'');
                    $pdf->SetXY(51, 122);
                    $pdf->Write(0, ''.$postal_add.'');
                    $pdf->SetXY(176, 133);
                    $pdf->Write(0, ''.$p_address.'');
                    $pdf->SetXY(51, 145);
                    $pdf->Write(0, ''.$res_add.'');
                    $pdf->SetXY(176, 156);
                    $pdf->Write(0, ''.$postalcode.'');
                    $pdf->SetXY(70, 171);
                    $pdf->Write(0, ''.$magist.'');
                    $pdf->SetXY(33, 198);
                    $pdf->Write(0, ''.$language_speak.'');
                    $pdf->SetXY(162, 198);
                    $pdf->Write(0, ''.$newinitial.'');
                    $pdf->SetXY(128, 218);
                    $pdf->Write(0, ''.$cell_num.'');
                    $pdf->SetXY(128, 225);
                    $pdf->Write(0, ''.$id_number.'');
                    $pdf->SetFontSize('18');
                    $pdf->SetXY(68, 255);
                    $pdf->Write(0, ''.$married_in.'');
                    $pdf->Output(BASEPATH.
                                        'pdfs/mypdf-e1_'.$name.'.pdf', 'I');
                    //$pdf->closeParsers();

                    //$this->fpdf->Output('output.pdf','D');
                
            }
        }


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.