summaryrefslogtreecommitdiffstats
path: root/pdftool.pl
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@ens-lyon.org>2011-05-19 19:06:54 +0200
committerGuilhem Moulin <guilhem.moulin@ens-lyon.org>2011-05-19 19:06:54 +0200
commit9a4339be5db829cb84c8d0f6e1647619951e828b (patch)
treecbe6f775732262505cf51987a0a542ec68e64257 /pdftool.pl
parent0fc3f1a299607e93e7857be8a579263218ea8dec (diff)
compatiblity with other versions of psutils; doesn't work with pdftops though (-origpagesizes)
Diffstat (limited to 'pdftool.pl')
-rwxr-xr-xpdftool.pl19
1 files changed, 9 insertions, 10 deletions
diff --git a/pdftool.pl b/pdftool.pl
index 2088958..b08b4aa 100755
--- a/pdftool.pl
+++ b/pdftool.pl
@@ -375,7 +375,7 @@ finally {
};
# Useless, but Perl doesn't see that this filehandle is used more than
-# one time
+# one time
close IN; # automatically closed by `open3'
close OUT;
@@ -392,7 +392,7 @@ sub pdftops {
my $IN = $_[0];
my $OUT;
-
+
#
# Detect filetype
#
@@ -407,21 +407,21 @@ sub pdftops {
while (not (defined $filetype) && defined (my $l = <$IN>)) {
print $WRITE ($l) or die "Can't close: $!";
-
+
if (defined $l && $l =~ /^%!PS/) {
$filetype = "PS";
} elsif (defined $l && $l =~ /^%PDF/) {
$filetype = "PDF";
}
}
-
+
die "Can't recognize the filetype" unless defined $filetype;
-
+
unless (my $pid = fork) {
# Child: cat $IN > $WRITE in background
die "Can't fork: $!" unless defined $pid;
close $READ or die "Can't close: $!";
-
+
while (<$IN>) {
print $WRITE ($_) or die "Can't print: $!";
}
@@ -498,8 +498,7 @@ sub pdftops {
push @cmd, '-l', $last if defined $last;
push @cmd, '-q' if defined $quiet;
- my $pid = open $OUT, "-|", @cmd
- or die "Can't run `" . &printcmd (@cmd) . "'";
+ my $pid = open $OUT, "-|", @cmd;
push @pids, [$pid, @cmd];
return $OUT;
@@ -514,7 +513,7 @@ sub psselect {
my $IN = $_[0];
my $OUT;
- my @cmd = ('psselect', '-p', $select);
+ my @cmd = ('psselect', '-p'. $select);
push @cmd, '-q' if defined $quiet;
*IN = $IN;
@@ -782,7 +781,7 @@ sub psnup {
. ',' . join ('+', @especs);
}
- my @cmd = ('pstops', '-w', $bbox[2], '-h', $bbox[3], $pagespecs);
+ my @cmd = ('pstops', '-w'. $bbox[2], '-h'. $bbox[3], $pagespecs);
push @cmd, '-q' if defined $quiet;
*IN = $IN;