C O N O S C E N Z A
web data management
Il nostro è un team che si occupa ormai da piu' di un decennio della risoluzione delle problematiche informatiche, in particolare ci piace poter offrire la nostra competenza in ambito telematico, dalla progettazione su misura della vostra infrastruttura web, alla realizzazione del vostro software e dei vostri portali.
Zend Framework

Zend_pdf -Zend controller rules

06/06/2008

    Esempio sintassi per la stampa di un pdf per zend controler v 1.0.X e 1.5.

Di seguito il codice dell'azione print del controller per una gestione fatturazione.

Nel frattempo che Zend rilascerà una nuova e più completa versione della classe zend_pdf, torno ad usare la Ross EzPdz_class.php

Example for printing  pdf in zend controler v 1.0.X and 1.5.

Here the code of the print action for a vat controller.

Waiting for a new more exaustive  zend_pdf release I come back to use Ross EzPdz_class.php 

 

require_once 'Zend/Pdf.php';
            $pdf = new Zend_Pdf();


            $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
            $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 13);

            // Draw text
            $Y=700;
            $page->drawText("$TYPE ". $row['V_Number']."", 169, $Y);
            $Y=$Y-20;
            $page->drawText("Spett. ", 309, $Y);
            $Y=$Y-20;
            $page->drawText($Anagrafica['V_Name']." ".$Anagrafica['V_Surname'], 309, $Y);
            $Y=$Y-20;
            $page->drawText($Anagrafica['V_Adddress'], 309, $Y);
            $Y=$Y-20;
            $page->drawText($Anagrafica['V_CAP']." - ".$Anagrafica['V_City']." (".$Anagrafica['V_State'].")", 309, $Y);
            $Y=$Y-20;
            
           
                if($row['V_CF']!=""){
                $page->drawText("Codice Fiscale: ".$Anagrafica['V_CF'], 309, $Y);
            $Y=$Y-20;
            }
                        if($row['V_PI']!=""){
                $page->drawText("Partita IVA: ".$Anagrafica['V_PI'], 309, $Y);
            $Y=$Y-20;
            }

           
            $Y=$Y-20;
           
            $page->drawText("Servizi in fatturazione ", 69, $Y);
            $Y=$Y-20;
           
                if($row['V_Ref']!=""){
                $page->drawText('Riferimento: '.$row['V_Ref'].'', 69, $Y);
                $Y=$Y-20;
            }
       
 foreach ($services as $key => $value) {
     if (intval($value['quantitaprodotto']==0)){
         $value['quantitaprodotto']=1;
     }
     $page->drawText("N. ".$value['quantitaprodotto']." ".$value['prodotto']." Euro: ".$value['prezzo_venditaprodotto'], 69, $Y);
     $Y=$Y-20;
    
 }
           
           
           

           
            $pdf->pages[] = $page;
            $pdfData=$pdf->render();
            header("Content-Disposition: inline; filename=result.pdf");
            header("Content-type: application/x-pdf");
            echo $pdfData;