FAQ
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 <jj@jonallen.info>
http://perl.jonallen.info :: http://perldoc.perl.org

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

Search Discussions

  • Felix Antonius Wilhelm Ostmann at Feb 9, 2009 at 10:56 am

    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!


    --
    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: info@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
    --------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedFeb 7, '09 at 4:29p
activeFeb 9, '09 at 10:56a
posts2
users2
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase