diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-16 15:56:12 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-16 15:56:12 +0000 |
commit | 1781468582b9eac650f45c874134ed8a671bfdfe (patch) | |
tree | 1e6e595e08f444cfac18552f62eadfb2b2a8e473 /LedgerSMB/Template/PDF.pm | |
parent | c24b6d1d47bf5d0bb2771067ba03955a5877201f (diff) |
Add support for templates in string form
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1618 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Template/PDF.pm')
-rwxr-xr-x | LedgerSMB/Template/PDF.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/LedgerSMB/Template/PDF.pm b/LedgerSMB/Template/PDF.pm index 617ca41f..ef7ca519 100755 --- a/LedgerSMB/Template/PDF.pm +++ b/LedgerSMB/Template/PDF.pm @@ -74,9 +74,17 @@ sub process { my $parent = shift; my $cleanvars = shift; my $template; + my $source; $parent->{outputfile} ||= "${LedgerSMB::Sysconfig::tempdir}/$parent->{template}-output-$$"; + if (ref $parent->{template} eq 'SCALAR') { + $source = $parent->{template}; + } elsif (ref $parent->{template} eq 'ARRAY') { + $source = join "\n", @{$parent->{template}}; + } else { + $source = get_template($parent->{template}); + } $template = Template::Latex->new({ LATEX_FORMAT => 'pdf', INCLUDE_PATH => $parent->{include_path}, @@ -88,7 +96,7 @@ sub process { }) || throw Error::Simple Template::Latex->error(); if (not $template->process( - get_template($parent->{template}), + $source, {%$cleanvars, %$LedgerSMB::Template::TTI18N::ttfuncs, 'escape' => \&preprocess}, "$parent->{outputfile}.pdf", binmode => 1)) { |