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
57
58
59
60
#!/usr/bin/perl
my $name = "test";
my $tex_file = "${name}.tex";
my $log_file = "${name}.log";
my $pdf_file = "${name}.pdf";
my $kopf = <<"END_OF_KOPF";
\\documentclass[pdftex,a4paper,11pt,titlepage]{scrartcl}
\\usepackage[latin1]{inputenc} % Eingabe-Zeichenkodierung
\\usepackage[T1]{fontenc} % Ausgabe-Zeichenkodierung
\\usepackage[pdftex]{graphicx}
\\usepackage{float}
\\begin{document}
END_OF_KOPF
my $titelpage = <<"END_OF_TITEL";
\\titlehead{Willi Wuschel GmbH\\\\
\\vspace{-2cm}
\\hspace{8cm}
\\includegraphics[width=9cm]{logo.png}}
\\subject{Neues}
\\title{\\Large{Bilderbuch}}
\\author{Balduin Bankerotti}
\\publishers{Publishing Corp.}
\\maketitle
\\tableofcontents
END_OF_TITEL
my $bild = "Babyfoto1.png";
my $bildunterschrift = "Das ist ...";
my $text = "\\newpage\n";
$text .= "\\section{Babyfotos}\n\n";
$text .= "\\begin{figure}[H]\n";
$text .= "\\centering\n";
$text .= "\\includegraphics[width=6cm,height=5cm]{$bild}\n";
$text .= "\\caption{$bildunterschrift}\n";
$text .= "\\end{figure}\n\n";
$text .= "\\end{document}\n\n";
open(my $fh, ">", $tex_file) or die "cannot open > $tex_file: $!";
print $fh $kopf;
print $fh $titelpage;
print $fh $text;
close $fh;
system("pdflatex -interaction=batchmode $tex_file >> $log_file}");
system("pdflatex -interaction=batchmode $tex_file >> $log_file}");
my $pdf_test = `gs -o nul -sDEVICE=nullpage $pdf_file`;
if ($pdf_test =~ /Error/) {
print "\nFehler in der PDF-Datei. STOP!!\n";
} else {
print " ... ok ...\n";
print " $pdf_file erfolreich erzeugt.\n\n";
}