[wellwell-devel] [wellwell/zoom] Add combine function to [pdf] tag.
Git
wellwell-devel at rt.icdevgroup.org
Fri Feb 18 13:14:19 UTC 2011
commit 6937c0679318c9894e571202d137211e6fbe5966
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Fri Feb 18 14:05:45 2011 +0100
Add combine function to [pdf] tag.
lib/Vend/PDF.pm | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/lib/Vend/PDF.pm b/lib/Vend/PDF.pm
index 963c84e..3fda790 100644
--- a/lib/Vend/PDF.pm
+++ b/lib/Vend/PDF.pm
@@ -32,15 +32,20 @@ use Vend::Data;
use Vend::Tags;
# define [pdf] tag
-Vend::Config::parse_tag('UserTag', 'pdf Order specification template output');
+Vend::Config::parse_tag('UserTag', 'pdf Order function specification template output');
Vend::Config::parse_tag('UserTag', 'pdf AddAttr');
Vend::Config::parse_tag('UserTag', 'pdf MapRoutine Vend::PDF::pdf');
# [pdf]
sub pdf {
- my ($specification, $template, $output, $opt) = @_;
- my (%input, $locale);
+ my ($function, $specification, $template, $output, $opt) = @_;
+ my (%input, $locale, $ret);
+ if ($function eq 'combine') {
+ $ret = combine($output, $opt->{files});
+ return;
+ }
+
# input for Zoom template
if (exists $opt->{input}) {
%input = %{$opt->{input}};
@@ -131,4 +136,21 @@ sub pdf {
return;
}
+sub combine {
+ my ($output, $files) = @_;
+ my ($pdf, $import);
+
+ $pdf = new Template::Zoom::PDF (file => $output);
+
+ $import = new Template::Zoom::PDF::Import;
+
+ for my $pdf_file (@$files) {
+ $import->import(pdf => $pdf->{pdf}, file => $pdf_file);
+ }
+
+ $pdf->{pdf}->saveas();
+
+ return $output;
+}
+
1;
More information about the wellwell-devel
mailing list