Ignore:
Timestamp:
2001-04-01T21:19:25+12:00 (23 years ago)
Author:
sjboddie
Message:

Tidied up the ConvertToPlug stuff to get it working on Windows 95/98

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/pdftohtml.pl

    r2118 r2241  
    177177    print STDERR "pdftohtml.pl: $input_filename appears to have no ";
    178178    print STDERR "textual data. Aborting.\n";
    179     print STDERR "num: $unenc_stream_objects and $non_text_objects from $num_objects\n";
     179    # print STDERR "num: $unenc_stream_objects and $non_text_objects from $num_objects\n";
    180180    exit(1);
    181181    }
    182182
    183183    # formulate the command
    184     my $pdftohtml = &util::filename_cat($ENV{'GSDLHOME'}, "bin",
    185                     $ENV{'GSDLOS'}, "pdftohtml.bin");
    186     return 0 unless (-e "$pdftohtml");
    187    
    188     $cmd = "";
     184    my $cmd = &util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "pdftohtml.bin");
     185
     186    # don't include path on windows (to avoid having to play about
     187    # with quoting when GSDLHOME might contain spaces) but assume
     188    # that the PATH is set up correctly - note also that on windows
     189    # we use pdftohtml.exe not pdftohtml.bin
     190    $cmd = "pdftohtml" if ($ENV{'GSDLOS'} !~ /^windows$/) {
     191
    189192    if ($timeout) {$cmd = "ulimit -t $timeout;";}
    190     $cmd .= "$pdftohtml -noframes";
    191     $cmd .= " \"$input_filename\" \"$output_filestem.html\"";
    192     $cmd .= " >\"$output_filestem.out\" 2>\"$output_filestem.err\"";
    193    
     193    $cmd .= " -noframes \"$input_filename\" \"$output_filestem.html\"";
     194    $cmd .= " > \"$output_filestem.out\"";
     195
     196    # attempting to redirect STDERR on windows 95/98 is a bad idea
     197    $cmd .= " 2> \"$output_filestem.err\""
     198    if $ENV{'GSDLOS'} !~ /^windows$/i;
     199
    194200    if (system($cmd)>0) {
    195201    print STDERR "Error executing $cmd: $!\n";
     
    201207    # Need to convert images from PPM format to PNG format
    202208    my @images;
     209
    203210
    204211    open (IMAGES, "images.log");
     
    212219    my $cmd = "";
    213220    if ($ENV{'GSDLOS'} =~ /^windows/i) {
    214         $cmd = &util::filename_cat($ENV{'GSDLHOME'}, "bin", "windows", "pnmtopng.exe");
    215         $cmd .= " $image";
     221        $cmd = "pnmtopng $image";
    216222        if (system($cmd)!=0) {
    217223        print STDERR "Error executing $cmd\n";
Note: See TracChangeset for help on using the changeset viewer.