Re: [Catalyst] [Announce] Catalyst::View::PDF::Reuse released

2009-02-09 Thread Felix Antonius Wilhelm Ostmann

JJ schrieb:

Hi,

I've just released Catalyst::View::PDF::Reuse to CPAN. [1]

This is a module we developed at Penny's Arcade [2] to produce
receipts and shipping labels - I gave a lighting talk about it [3] at
Milton Keynes Perl Mongers which went down well, so here it is for
everyone to use.

The purpose of the module is to allow PDF files to be created from
Template Toolkit so that nothing needs to be hard-coded in your View,
the layout can all be controlled via templates.

When using View::PDF::Reuse, TT is given a 'pdf' object which has
methods corresponding to all the functions of PDF::Reuse. So by taking
advantage of PDF::Reuse's [4] ability to modify existing PDF documents
(such as a blank order form created in Word), it becomes possible to
generate quite complex PDF files without writing much code.

As an example, this is all you need in your controller (having already
stashed an 'order' object):

$c-stash-{pdf_template} = 'order_pdf.tt';
$c-forward('View::PDF::Reuse');

then the layout commands are in order_pdf.tt, allowing all of TT's
facilities - loops, filters, and so on - to be used:

[% pdf.prForm('customer_receipt.pdf') %]
[% pdf.prText(123,643,order.number) %]
[% pdf.prText(299,643,order.date) %]

If anyone has any suggestions for improvement, please let me know.
  
We dont use direct pdf anymore ... LaTeX! and then convert to pdf works 
very good!





Cheers,

JJ

[1] http://search.cpan.org/dist/Catalyst-View-PDF-Reuse
[2] http://www.pennysarcade.co.uk
[3] http://www.pennysarcade.co.uk/files/Creating_PDF_files_with_Catalyst.pdf
[4] http://search.cpan.org/dist/PDF-Reuse

  



--
Mit freundlichen Grüßen

Felix Antonius Wilhelm Ostmann
--
Websuche   Search   Technology   GmbH  Co. KG
Martinistraße 3  -  D-49080  Osnabrück  -  Germany
Tel.:   +49 541 40666-0 - Fax:+49 541 40666-22
Email: i...@websuche.de - Website: www.websuche.de
--
AG Osnabrück - HRA 200252 - Ust-Ident: DE814737310
Komplementärin: Websuche   Search   Technology
Verwaltungs GmbH   -  AG Osnabrück  -   HRB 200359
Geschäftsführer:  Diplom Kaufmann Martin Steinkamp
--


___
List: Catalyst@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/


[Catalyst] [Announce] Catalyst::View::PDF::Reuse released

2009-02-07 Thread JJ
Hi,

I've just released Catalyst::View::PDF::Reuse to CPAN. [1]

This is a module we developed at Penny's Arcade [2] to produce
receipts and shipping labels - I gave a lighting talk about it [3] at
Milton Keynes Perl Mongers which went down well, so here it is for
everyone to use.

The purpose of the module is to allow PDF files to be created from
Template Toolkit so that nothing needs to be hard-coded in your View,
the layout can all be controlled via templates.

When using View::PDF::Reuse, TT is given a 'pdf' object which has
methods corresponding to all the functions of PDF::Reuse. So by taking
advantage of PDF::Reuse's [4] ability to modify existing PDF documents
(such as a blank order form created in Word), it becomes possible to
generate quite complex PDF files without writing much code.

As an example, this is all you need in your controller (having already
stashed an 'order' object):

$c-stash-{pdf_template} = 'order_pdf.tt';
$c-forward('View::PDF::Reuse');

then the layout commands are in order_pdf.tt, allowing all of TT's
facilities - loops, filters, and so on - to be used:

[% pdf.prForm('customer_receipt.pdf') %]
[% pdf.prText(123,643,order.number) %]
[% pdf.prText(299,643,order.date) %]

If anyone has any suggestions for improvement, please let me know.


Cheers,

JJ

[1] http://search.cpan.org/dist/Catalyst-View-PDF-Reuse
[2] http://www.pennysarcade.co.uk
[3] http://www.pennysarcade.co.uk/files/Creating_PDF_files_with_Catalyst.pdf
[4] http://search.cpan.org/dist/PDF-Reuse

-- 
JJ j...@jonallen.info
http://perl.jonallen.info  ::  http://perldoc.perl.org

Stylish accessories to enhance your home... http://www.pennysarcade.co.uk

___
List: Catalyst@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/