Hello,
 I followed this how-to:

http://bakery.cakephp.org/articles/view/pdf-helper-using-fpdf

and this post:

http://groups.google.com/group/cake-php/browse_thread/thread/db72d5a02d700417/f04bb413117f6027?lnk=gst&q=fpdf#f04bb413117f6027

with my customization for work with FPDI.

In vendors directory are present:

(D) - FPDI
=> (D) - decoders
=> (D) - font
=> (F) - fpdf_tpl.php
=> (F) - fpdf.php
=> (F) - fpdi_pdf_parser.php
=> (F) - fpdi.php
=> (F) - pdf_context.php
=> (F) - pdf_parser.php
=> (F) - wrapper_functions.php

(D) = direcoty - (F) = file

My app/view/helpers/fpdi.php:

<?php
vendor('fpdi/fpdi');

if (!defined('PARAGRAPH_STRING')) define('PARAGRAPH_STRING', '~~~');

class fpdiHelper extends FPDI {

    var $helpers = array();

    function setup ($orientation='P',$unit='mm',$format='A4') {
        $this->FPDI($orientation, $unit, $format);
    }

    function fpdfOutput ($name = 'page.pdf', $destination = 'D') {
        return $this->Output($name, $destination);
    }
}
?>

My app/views/layouts/pdf.thtml:

<?php
        echo $content_for_layout;
?>

My app/views/sale_document/viewdocument.thtml:

<?php
        $pagecount = $fpdi->setSourceFile("proforma.pdf");
        $tplidx = $fpdi->ImportPage(1);
        $fpdi->AddPage();
        $fpdi->SetFont('Arial','B',16);
        $fpdi->Cell(40,10,$data);
        $fpdi->fpdfOutput();
?>

My app/controllers/sale_documents_controller.php:

<?php

        function viewdocument($type=1,$id_comanda) {
                $this->layout = 'pdf';
                switch ($type) {
                        default:
                                $this->set('data','Comanda  ID '.$id_comanda);
                        break;
                }
                $this->render();
        }

?>

My problem is that the output of this url:

http://127.0.0.1/cake/sale_documents/viewdocument/4/2

is "FPDF error: Some data has already been output to browser, can't
send PDF file"

Why???

Thanks,
Gianluca

p.s.: sorry for my english! :(

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to