Thursday, June 30, 2011

Re: FPDF or PDFlib with Cake

Hi
Thanks for all, it works. I found only one mistake it should be

public $Pdf = null

in helper, not private or for every method should be created method

Thanks for your help


2011/6/30 Dominik Gajewski <dominikgajewski1@gmail.com>:
> Ok i will check it, thanks
>
> 2011/6/30 gremlin <abba.bryant@gmail.com>:
>> If the fpdf libraries are at all recent you shouldn't have to use the
>> goofy php4 constructor. I think if you add your custom pdf class to
>> your vendors folder and instantiate it from a custom helper as a
>> member variable you could do a lot more, much more easily.
>>
>> I actually enjoyed this question so I whipped up a quick example for
>> you - https://gist.github.com/1055702
>> I make no guarantees that any of the code works right out of the 'box'
>> seeing as how I just wrote it and it hasn't been tested or even really
>> checked for consistency or errors but it should get you well on your
>> way to doing this the right way.
>>
>> On Jun 29, 3:17 pm, Dominik Gajewski <dominikgajews...@gmail.com>
>> wrote:
>>> Sam thanks for your patience and help
>>>
>>> 2011/6/30 Dominik Gajewski <dominikgajews...@gmail.com>:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> > Ok I solved all problems and it works
>>>
>>> > To last problem I added an extra argument to core function infpdf.php
>>>
>>> > functionFPDF($ww=null, $orientation='P', $unit='mm', $size='A4')
>>>
>>> > but if someone knows how to solve this without this trick i will
>>> > listen to suggestions
>>>
>>> > 2011/6/29 Dominik Gajewski <dominikgajews...@gmail.com>:
>>> >> in TestController i added this
>>>
>>> >> var $helpers = array('Pdf'=> array('orientation' => 'P','unit' => 'mm'
>>> >> , 'format'=> 'A4') );
>>>
>>> >> and got this error
>>>
>>> >> Notice (8): Array to string conversion [APP\vendors\fpdf\fpdf.php, line 135]
>>> >> Code | Context
>>> >> $orientation    =       array(
>>> >>        "orientation" => "P",
>>> >>        "unit" => "mm",
>>> >>        "format" => "A4"
>>> >> )
>>> >> $unit   =       "mm"
>>> >> $size   =       array(
>>> >>        210.001555556,
>>> >>        297.000083333
>>> >> )
>>> >> strtolower - [internal], line ??
>>> >>FPDF::FPDF() - APP\vendors\fpdf\fpdf.php, line 135
>>> >> View::_loadHelpers() - CORE\cake\libs\view\view.php, line 808
>>> >> View::_render() - CORE\cake\libs\view\view.php, line 709
>>> >> View::render() - CORE\cake\libs\view\view.php, line 426
>>> >> Controller::render() - CORE\cake\libs\controller\controller.php, line 909
>>> >> TestsController::indexPdf() - APP\controllers\tests_controller.php, line 12
>>> >> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
>>> >> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
>>> >> [main] - APP\webroot\index.php, line 83
>>> >>FPDFerror: Incorrect orientation: array
>>>
>>> >> So i put only var var $helpers = array('Pdf'=> 'P'));
>>>
>>> >> Notice (8): Undefined property: PdfHelper::$helpers
>>> >> [CORE\cake\libs\view\view.php, line 819]
>>>
>>> >> What is another way to launch constructor of PdfHelper
>>>
>>> >> 2011/6/29 Sam Sherlock <sam.sherl...@gmail.com>:
>>> >>> two things
>>>
>>> >>> 1) orienation error is due to you not setting the page as either landscape
>>> >>> or portrait.
>>> >>> it seems that it should default to portrait but that message suggests
>>> >>> something is wrong - its afpdferror and you should read the docs forfpdf
>>>
>>> >>> 2) $this->Fpdf->AddPage() for helpers in cake  1.3 (future proof I think it
>>> >>> still works $fpdf->AddPage() but 1.3 migration mentions changing this)
>>>
>>> >>> I am not sure which pdf tool I used back then I do know that I tried them
>>> >>> all before deciding on the one I used.  That feature of the site has since
>>> >>> been removed for other reasons
>>>
>>> >>>  - S
>>>
>>> >>> On 29 June 2011 20:44, Dominik Gajewski <dominikgajews...@gmail.com> wrote:
>>>
>>> >>>>        $fpdf->AddPage();
>>> >>>>    $fpdf->SetFont('Arial','B',16);
>>> >>>>    $fpdf->Cell(40,10,$data);
>>> >>>>    echo $fpdf->fpdfOutput();
>>>
>>> >>> --
>>> >>> Our newest site for the community: CakePHP Video Tutorials
>>> >>>http://tv.cakephp.org
>>> >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
>>> >>> others with their CakePHP related questions.
>>>
>>> >>> To unsubscribe from this group, send email to
>>> >>> cake-php+unsubscribe@googlegroups.com For more options, visit this group at
>>> >>>http://groups.google.com/group/cake-php
>>>
>>> >> --
>>> >> Pozdrawiam
>>> >> Dominik Gajewski
>>>
>>> > --
>>> > Pozdrawiam
>>> > Dominik Gajewski
>>>
>>> --
>>> Pozdrawiam
>>> Dominik Gajewski
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
>>
>
>
>
> --
> Pozdrawiam
> Dominik Gajewski
>

--
Pozdrawiam
Dominik Gajewski

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: