Thread Perl und PDF... (17 answers)
Opened by J-jayz-Z at 2005-05-18 05:24

renee
 2005-05-18 18:11
#55017 #55017
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Da es eine Art "Serienbrief" werden soll, würde ich Dir zu CPAN:PDF::Template raten.

Hier ein kleiner Beispielcode zu PDF::Create

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/perl -w

use strict;
use warnings;
use diagnostics;
use lib qw(../perllib/);
use PDF::Create;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
#use DBI;

my $cgi = CGI->new();
#print $cgi->header(-type => 'text/html');
print $cgi->redirect(-url => 'http://www.urlaub-im-ferienpark.de/tmp/testpdf.pdf');

my $pdf = new PDF::Create('filename' => '../tmp/testpdf.pdf',
'Version' => 1.2,
'PageMode' => 'UseOutlines',
'Author' => 'Renee Baecker <webmaster@urlaub-im-ferienpark.de>',
'Title' => 'Ferienparkdetails');

my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size("a4"));


# Add a page which inherits its attributes from $root
my $page = $root->new_page;

# Prepare 2 fonts
my $f1 = $pdf->font('Subtype' => 'Type1',
'Encoding' => 'WinAnsiEncoding',
'BaseFont' => 'Helvetica');
my $f2 = $pdf->font('Subtype' => 'Type1',
'Encoding' => 'WinAnsiEncoding',
'BaseFont' => 'Helvetica-Bold');

my $logo = $pdf->image('../tmp/EULE1.jpg');
my $arrow = $pdf->image('../tmp/arrow.gif');

$page->stringl($f2,15,20,780,'Informationen zum Ferienpark');
$page->image('image' => $logo, 'xpos' => 30 , 'ypos' => 600); # add the logo of parc
$page->image('image' => $arrow, 'xpos' => 400, 'ypos' => 690); # add arrow of navigation
$page->stringl($f1, 10, 420, 765, 'Beschreibung');
$page->image('image' => $arrow, 'xpos' => 400, 'ypos' => 660); # add arrow of navigation
$page->stringl($f1, 10, 420, 735, 'Kontakt');
$page->image('image' => $arrow, 'xpos' => 400, 'ypos' => 630); # add arrow of navigation
$page->stringl($f1, 10, 420, 705, 'Bewertungen');
$page->image('image' => $arrow, 'xpos' => 400, 'ypos' => 600); # add arrow of navigation
$page->stringl($f1, 10, 420, 675, 'Sonstiges');
$page->stringc($f2, 8, 300, 2, "Created by http://www.Urlaub-im-Ferienpark.de");



# Add the missing PDF objects and a the footer then close the file
$pdf->close;

print $cgi->h2('PDF erzeugt');
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Perl und PDF...