Ignore:
Timestamp:
2002-02-20T16:30:17+13:00 (22 years ago)
Author:
jrm21
Message:

added infrastructure for calling an external powerpoint to html converter.

File:
1 edited

Legend:

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

    r2755 r2977  
    6060    print STDERR "              or text using third-party programs.\n\n";
    6161    print STDERR "  usage: $0 [options] filename\n";
    62     print STDERR "  options:\n\t-type\tdoc|pdf|ps|rtf\t(input file type)\n";
     62    print STDERR "  options:\n\t-type\tdoc|pdf|ps|ppt|rtf\t(input file type)\n";
    6363    print STDERR "\t-errlog\t<filename>\t(append err messages)\n";
    6464    print STDERR "\t-output\thtml|text\n";
     
    7777    # read command-line arguments
    7878    if (!parsargv::parse(\@ARGV,
    79              'type/(doc|pdf|ps|rtf)/', \$input_type,
     79             'type/(doc|pdf|ps|ppt|rtf)/', \$input_type,
    8080             '/errlog/.*/', \$faillogfile,
    8181             'output/(html|text)/', \$output_type,
     
    132132    print "\n";
    133133    }
     134    elsif ($input_type eq "ppt") {
     135    print &convertPPT($input_filename, $output_filestem, $output_type);
     136    print "\n";
     137    }
    134138    else {
    135139    print STDERR "Error: Unable to convert type '$input_type'\n";
     
    286290
    287291}
     292
     293
     294sub convertPPT {
     295    my ($input_filename, $output_filestem, $output_type) = @_;
     296
     297    my $success = 0;
     298
     299    # Attempt conversion to HTML
     300    if (!$output_type || ($output_type =~ /html/i)) {
     301    # formulate the command
     302    $cmd = "";
     303    $cmd .= "perl -S ppttohtml.pl ";
     304    $cmd .= " \"$input_filename\" \"$output_filestem.html\"";
     305    $cmd .= " 2>\"$output_filestem.err\""
     306        if ($ENV{'GSDLOS'} !~ /^windows$/i || $is_winnt_2000);
     307   
     308   
     309    # execute the command
     310    $!=0;
     311    if (system($cmd)!=0)
     312    {
     313        print STDERR "Powerpoint converter failed $!\n";
     314    } else {
     315        return "html";
     316    }
     317    }
     318
     319    $success = &any_to_text($input_filename, $output_filestem);
     320    if ($success) {
     321    return "text";
     322    }
     323
     324    return "fail";
     325}
     326
     327
     328
    288329
    289330
Note: See TracChangeset for help on using the changeset viewer.