On Wed, 2009-10-21 at 09:42 +1000, Jason Galea wrote:
> my $doc = HTML::HTMLDoc->new( 'mode' => 'file', 'tmpdir' =>
> $self->config->{tmp_dir} );
> $doc->set_page_size($self->config->{page_size});
> $doc->set_header(@{$self->config->{header}});
> $doc->set_footer(@{$self->config->{footer}});
> $doc->set_html_content($output);
>
> my $pdf = $doc->generate_pdf();
>
> unless ( $c->response->content_type ) {
> $c->response->content_type('text/pdf; charset=utf-8');
> }
>
> $c->res->header( 'Content-Disposition' =>
> 'attachment;filename='.$c->stash->{pdf_filename} );
>
> $c->response->body($pdf->to_string());
>
> return 1;
> }
Thanks for this! I did get this working, the only change I seemed to
have to make was
$c->response->content_type('application/pdf');
In order to get my browser to open it using a pdf reader (with
'text/pdf' it was using a text editor).
Thanks again!
Steve
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/