[Catalyst] Empty pdf file/ using Catalyst::View::PDF::Reuse

Lupin Deterd lupindeterd at gmail.com
Wed Mar 10 13:04:31 GMT 2010


On Wed, Mar 10, 2010 at 1:36 PM, Charlie Garrison <garrison at zeta.org.au> wrote:
> Good afternoon,
>
> On 6/03/10 at 4:51 PM +0800, Lupin Deterd <lupindeterd at gmail.com> wrote:
>
>> I'm using View::PDF::Reuse to create/generate pdf, and though it
>> successfully create one but it's empty, following is code/template.
>> -- template/receipt.tt2 --
>>
>> [% pdf.prFont('Helvetica-Bold') %]
>> [% pdf.prFontSize(50) %]
>>
>>
>> [% y = 500 %]
>> [% FOREACH item IN list %]
>> [% pdf.prText(100,y,item) %]
>> [% y = y - 13 %]
>> [% END %]
>
> Try printing something other than `item`, eg. just a simple scalar "test
> value", to ensure you're not simply printing blank values.
>
> Also, try ending with pdf.prPage(). I was having problems with blank PDFs
> and that may have fixed it; I can't recall exactly, I tried heaps of methods
> before getting it all working right with multi-page PDFs.
>
>
> Charlie
>
> --
>   Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>
>   〠 PO Box 141, Windsor, NSW 2756, Australia
>
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> http://www.ietf.org/rfc/rfc1855.txt
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

Thank you for all the helpful replies, I  now have a working
C::V::P::R, it produced a pdf file with contents. I was able to
received help from hobbs on #catalyst, the root cause of problem is
that C::V::P::R produces the pdf file even it cannot find the template
files, hobbs suggest that it can be file as bug but I don't have idea
how(I newbie on both Perl/Cat).

 Anyway both C::V::P::R and C::V::PDF::API2 has the same outcome it
will produce empty pdf file even it can't find the template.

e.g

on MyApp.pm:

__PACKAGE__->config('View::PDF::Reuse' => {
   INCLUDE_PATH => __PACKAGE__->path_to('root','templates') # this
will produce empty pdf
 });                             __PACKAGE__->path_to('root','src') #
after I added this it works.

on Controller:

{
      $c->stash->{list} = ['one', 'two', 'three', 'four'];
      $c->stash->{pdf_disposition} = 'attachment';
      $c->stash->{pdf_filename}    = 'receipt.pdf';
      $c->stash->{pdf_template}    = 'order/receipt.tt2';
      $c->detach( $c->view('PDF::Reuse') );

  }

actual path of template files, in this case receipt.tt2:

root/src/order/receipt.tt2

regards,
lupin



More information about the Catalyst mailing list