On 22 Oct 2008, at 20:50, Aristotle Pagaltzis wrote:

* Kirby Krueger <[EMAIL PROTECTED]> [2008-10-22 20:20]:
Can someone give me those few lines? :-)

sub MyApp::Controller::Root::renderview : ActionClass('RenderView') {}

   sub MyApp::Controller::Root::end : Private {
       my $self = shift;
       my ( $c ) = @_;
       $c->forward( '/renderview' );
       if ( $c->req->param( 'pdf' ) ) {
my @pdf_cmd = Text::ParseWords::shellwords( $c->config- >{ pdf_cmd } );
           $c->res->content_type( 'application/pdf' );
$c->res->body( IPC::Filter::filter( $c->res->body, @pdf_cmd ) );
       }
   }

And in `myapp.conf`:

   pdf_cmd prince -i html -s prince.css -o - -

Yes, PrinceXML <http://www.princexml.com/> costs $$$, *however*,
it renders HTML to PDF verbatim instead of requiring you to use
completely different stuff like FOP or LaTeX – which is an
especially big selling point if you’re looking to generate PDF
from a CMS-ish thing where users can enter HTML content. It also
supports pretty much all print-related CSS stuff, which includes
control over line breaks and the like, and also provides
proprietary CSS extensions to do things like page headers and
footers, page numbering, and so on. For us, the effort we avoided
of having to write PDF-specific code (the above lines are
literally the only PDF-related code in the app) and then maintain
it over more than made up for the price tag.



Sounds interesting - In fact so interesting i contemplated doing something similar a few months ago before decided i didn't have time due to major release in like 3 days time >_>


http://perlitist.com/static/talks/pdf_typesetting.pdf <-- I even wrote a talk about it :)

(No i've not really got anywhere with the code since. I've spent about a total of 6 hours on it since I gave that talk)

-ash


_______________________________________________
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/

Reply via email to