SAA: add saa_wcstring()
[nasm.git] / doc / pspdf.pl
blob961a8ae1958b45e3c9f19e38a41f6e45d56db2be
1 #!/usr/bin/perl
3 # Wrapper around a variety of programs that can do PS -> PDF conversion
6 use strict;
8 my $compress = 1;
10 while ($ARGV[0] =~ /^-(.*)$/) {
11 my $opt = $1;
12 shift @ARGV;
14 if ($opt eq '-nocompress') {
15 $compress = 0;
19 my ($in, $out) = @ARGV;
21 if (!defined($out)) {
22 die "Usage: $0 [-nocompress] infile outfile\n";
25 # Remove output file
26 unlink($out);
28 # 1. Acrobat distiller
29 my $r = system('acrodist', '-n', '-q', '--nosecurity', '-o', $out, $in);
30 exit 0 if ( !$r && -f $out );
32 # 2. ps2pdf (from Ghostscript)
33 my $r = system('ps2pdf', '-dOptimize=true', '-dEmbedAllFonts=true',
34 '-dCompressPages=' . ($compress ? 'true' : 'false'),
35 '-dUseFlateCompression=true', $in, $out);
36 exit 0 if ( !$r && -f $out );
38 # 3. pstopdf (BSD/MacOS X utility)
39 my $r = system('pstopdf', $in, '-o', $out);
40 exit 0 if ( !$r && -f $out );
42 # Otherwise, fail
43 unlink($out);
44 exit 1;