From a02d6065bf595a427e41d509b2d1d6bbd9138c7b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 18 Feb 2014 11:55:40 +0100 Subject: [PATCH] CreatePDF-Helfer: Dokumentation --- SL/Helper/CreatePDF.pm | 132 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/SL/Helper/CreatePDF.pm b/SL/Helper/CreatePDF.pm index 10618b214..8d36eb749 100644 --- a/SL/Helper/CreatePDF.pm +++ b/SL/Helper/CreatePDF.pm @@ -153,3 +153,135 @@ sub find_template { } 1; +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::Helper::CreatePDF - A helper for creating PDFs from template files + +=head1 SYNOPSIS + + # Retrieve a sales order from the database and create a PDF for + # it: + my $order = SL::DB::Order->new(id => …)->load; + my $print_form = Form->new(''); + $print_form->{type} = 'invoice'; + $print_form->{formname} = 'invoice', + $print_form->{format} = 'pdf', + $print_form->{media} = 'file'; + + $order->flatten_to_form($print_form, format_amounts => 1); + $print_form->prepare_for_printing; + + my $pdf = SL::Helper::CreatePDF->create_pdf( + template => 'sales_order', + variables => $print_form, + ); + +=head1 FUNCTIONS + +=over 4 + +=item C + +Parses a LaTeX template file, creates a PDF for it and returns either +its content or its file name. The recognized parameters are: + +=over 2 + +=item * C