cb52d49a45
Make the tool write the output (especially HTML) in a specified subdirectory directly, and make the tool create the subdirectory if it doesn't already exists. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
31 lines
603 B
Perl
Executable file
31 lines
603 B
Perl
Executable file
#!/usr/bin/perl
|
|
#
|
|
# Wrapper around a variety of programs that can do PS -> PDF conversion
|
|
#
|
|
|
|
use strict;
|
|
|
|
my ($in, $out) = @ARGV;
|
|
|
|
if (!defined($out)) {
|
|
die "Usage: $0 infile outfile\n";
|
|
}
|
|
|
|
# Remove output file
|
|
unlink($out);
|
|
|
|
# 1. Acrobat distiller
|
|
my $r = system('acrodist', '-n', '-q', '--nosecurity', '-o', $out, $in);
|
|
exit 0 if ( !$r && -f $out );
|
|
|
|
# 2. ps2pdf (from Ghostscript)
|
|
my $r = system('ps2pdf', $in, $out);
|
|
exit 0 if ( !$r && -f $out );
|
|
|
|
# 3. pstopdf (BSD/MacOS X utility)
|
|
my $r = system('pstopdf', $in, '-o', $out);
|
|
exit 0 if ( !$r && -f $out );
|
|
|
|
# Otherwise, fail
|
|
unlink($out);
|
|
exit 1;
|