[Catalyst-commits] r11271 - in Catalyst-View-PDF-API2/trunk:
lib/Catalyst/View/PDF t/lib/TestApp/root/pdf_templates
ferz at dev.catalyst.perl.org
ferz at dev.catalyst.perl.org
Sat Aug 29 09:40:34 GMT 2009
Author: ferz
Date: 2009-08-29 09:40:34 +0000 (Sat, 29 Aug 2009)
New Revision: 11271
Modified:
Catalyst-View-PDF-API2/trunk/lib/Catalyst/View/PDF/API2.pm
Catalyst-View-PDF-API2/trunk/t/lib/TestApp/root/pdf_templates/test_pdf.tt
Log:
fixed test_pdf.tt but now lib/Catalyst/View/PDF/API2::compress do not get $c
Modified: Catalyst-View-PDF-API2/trunk/lib/Catalyst/View/PDF/API2.pm
===================================================================
--- Catalyst-View-PDF-API2/trunk/lib/Catalyst/View/PDF/API2.pm 2009-08-29 07:30:36 UTC (rev 11270)
+++ Catalyst-View-PDF-API2/trunk/lib/Catalyst/View/PDF/API2.pm 2009-08-29 09:40:34 UTC (rev 11271)
@@ -146,26 +146,27 @@
sub render_pdf {
my ($self, $c) = @_;
-
+
+ my $c->stash->{pdf} = PDF::API2->new;
+ # [% USE pdf = Catalyst::View::PDF::API2 %]
my $template = <<'EOT';
- [% USE pdf = Catalyst::View::PDF::API2 %]
[% PROCESS $pdf_template %]
EOT
# my $tempfile = tmpnam();
# $pdf = PDF::API2->open($tempfile);
#
- my $pdf = PDF::API2->new;
- SEARCH: foreach my $path (@{$self->config->{INCLUDE_PATH}}) {
- if (-e catfile($path,$c->stash->{pdf_template})) {
- local $CWD = $path;
- my $output = $self->render($c,\$template);
- last SEARCH;
- }
- }
-
- my $pdfout = $pdf->stringify;
- $pdf->end;
+
+ #SEARCH: foreach my $path (@{$self->config->{INCLUDE_PATH}}) {
+ # if (-e catfile($path,$c->stash->{pdf_template})) {
+ # local $CWD = $path;
+ # my $output = $self->render($c,\$template);
+ # last SEARCH;
+ # }
+ #}
+
+ my $pdfout = $c->stash->{pdf}->stringify;
+ $$c->stash->{pdf}->end;
return $pdfout;
}
Modified: Catalyst-View-PDF-API2/trunk/t/lib/TestApp/root/pdf_templates/test_pdf.tt
===================================================================
--- Catalyst-View-PDF-API2/trunk/t/lib/TestApp/root/pdf_templates/test_pdf.tt 2009-08-29 07:30:36 UTC (rev 11270)
+++ Catalyst-View-PDF-API2/trunk/t/lib/TestApp/root/pdf_templates/test_pdf.tt 2009-08-29 09:40:34 UTC (rev 11271)
@@ -1,5 +1,8 @@
- [% f1 = pdf->corefont('Helvetica') %]
+ [% f1 = pdf->corefont('Helvetica', -encode=>'latin1') %]
[% page = pdf.page %]
- [% page.mediabox(595,842) %]
+ [% page.mediabox(421,595) %]
[% text = page.text %]
- [% text.textlabel(50,800,$f1,20,data,-hspace=>75) %]
+ [% text.font(f1, 20) %]
+ [% text.translate(50,500) %]
+ [% text.text('Hello World') %]
+
More information about the Catalyst-commits
mailing list