Hallo zusammen,
ich versuch grad ein kleines Script zu schreiben, welches mir aus jeweils 10 (oder) mehr vorhandenen PDFs bestimmte Seiten rausfilter und in einen neue PDF schreibt ("*.pdf-n").
Ich würde das gern mit einer FOREACH-Schleife durchführen! Hier meine Einfall:
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
use warnings;
use strict;
use Data::Dumper;
use PDF::Reuse;
opendir (DIR, 'C:\Dokumente und Einstellungen\Administrator\Eigene Dateien\Eclipse_Workspace\Perl\PDF\old') || die "Fehler beim Einlesen des Verzeichnisses: $!";
my @files = readdir(DIR);
close DIR;
shift(@files);
shift(@files);
print Dumper (@files);
print "FOREACH\n";
foreach my $datei (@files){
print "$datei\n";
prFile("$datei-n");
prDoc(
{
file => '$datei',
first => 1,
last => 3
}
);
prEnd();
}
Im Array Files werden mir alle vorhandenen PDFs angezeigt. Testweise soll von jedem PDF die Seite 1 - 3 in eine neue PDF-Datei gespeichert werden.
Leider kommt nur eine Fehlermeldung:
QuoteAn error occurred
at C:/Dokumente und Einstellungen/Administrator/Eigene Dateien/Eclipse_Workspace/Perl/PDF/pdf.pl line 22
The file $datei can't be found, aborts
More information might be found in
error.log
at C:/Dokumente und Einstellungen/Administrator/Eigene Dateien/Eclipse_Workspace/Perl/PDF/pdf.pl line 22
Text in error.log:
The file $datei can't be found, aborts
The error occurred when executing:
at C:/Perl/site/lib/PDF/Reuse.pm line 1231
PDF::Reuse::findGet('$datei', '') called at blib\lib\PDF\Reuse.pm (autosplit into blib\lib\auto\PDF\Reuse\analysera.al) line 5856
PDF::Reuse::analysera('$datei', 1, 3) called at blib\lib\PDF\Reuse.pm (autosplit into blib\lib\auto\PDF\Reuse\prDoc.al) line 3562
PDF::Reuse::prDoc('HASH(0x187ad34)') called at C:/Dokumente und Einstellungen/Administrator/Eigene Dateien/Eclipse_Workspace/Perl/PDF/pdf.pl line 22
Situation when the error occurred
Bytes written to the current pdf-file, pos = 15
Object processed, not necessarily written objNr = 3
Current pdf-file, utfil = DIE_NEUE_PDF.pdf-n
File logging the run, runfil = undef
Local time = Mon Feb 7 16:58:37 2011
Habt ihr nen Tip für mich?