Changeset 1928 for trunk/gsdl/bin/script/gsConvert.pl
- Timestamp:
- 2001-02-08T13:49:27+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/gsConvert.pl
r1734 r1928 60 60 my (@ARGV) = @_; 61 61 my ($input_type,$output_type,$verbose,$timeout); 62 62 63 63 $timeout = 0; 64 64 # read command-line arguments … … 76 76 print_usage(); 77 77 } 78 78 79 my $input_filename = $ARGV[0]; 79 80 if (!-r $input_filename) { … … 102 103 } 103 104 elsif ($input_type eq "doc") { 104 print STDERR "I recognise this to be a Word document...\n"; # remove105 105 print &convertDOC($input_filename, $output_filestem, $output_type); 106 106 print "\n"; … … 149 149 my $realtype = &find_docfile_type($input_filename); 150 150 151 print STDERR "The real type of this Word document is $realtype\n"; # remove152 153 151 if ($realtype eq "word6" || $realtype eq "word7" || $realtype eq "word8") { 154 print STDERR "I recognise this to be a word678 document...\n"; # remove155 152 return &convertWord678($input_filename, $output_filestem, $output_type); 156 153 } elsif ($realtype eq "rtf") { … … 328 325 329 326 sub doc_to_html { 330 print STDERR "/;-DG I am in doc_to_html...\n"; # remove331 327 ($input_filename, $output_filestem) = @_; 332 328 333 329 my $wvWare = ""; 334 330 my $wv_conf = ""; 331 335 332 if ($ENV{'GSDLOS'} =~ /^windows$/i) { 336 333 $wvWare = "$ENV{'GSDLHOME'}\\bin\\windows\\wvWare.exe"; … … 343 340 $wvWare = &util::filename_cat($wv_home, "bin", "wvWare"); 344 341 } 345 print STDERR "I am about to test if your file exists...\n";346 342 return 0 unless (-e "$wvWare"); 343 347 344 $cmd = ""; 348 345 if ($timeout) {$cmd = "ulimit -t $timeout;";} … … 350 347 $cmd .= " \"$input_filename\" > \"$output_filestem.html\" 2>\"$output_filestem.err\""; 351 348 352 print STDERR "$cmd\n"; #remove353 354 349 # execute the command 355 print STDERR system($cmd);356 print STDERR "\n";357 350 if (system($cmd)>0) 358 351 { … … 374 367 } 375 368 } 376 print STDERR "/;-DG I am leaving doc_to_html...\n"; 369 377 370 return 0; 378 371 } … … 427 420 ($dirname, $input_filename, $output_filestem) = @_; 428 421 429 # formulate the command430 my $p_home = &util::filename_cat($ENV{'GSDLHOME'}, "packages", "unix", "pdftohtml");431 my $pdftohtml = &util::filename_cat($p_home, "pdftohtml_0_20", "pdftohtml.bin");432 return 0 unless (-e "$pdftohtml");433 434 422 $cmd = ""; 435 423 if ($timeout) {$cmd = "ulimit -t $timeout;";} 436 $cmd .= "$pdftohtml -noframes"; 437 $cmd .= " \"$input_filename\" \"$output_filestem.html\""; 438 $cmd .= " >\"$output_filestem.out\" 2>\"$output_filestem.err\""; 424 $cmd .= "pdftohtml.pl -F "; 425 $cmd .= " \"$input_filename\" \"$output_filestem\""; 439 426 440 427 if (system($cmd)>0) 441 428 { 442 429 print STDERR "Error executing $cmd: $!\n"; 443 &util::rm("$output_filestem.html") if (-e "$output_filestem.html");444 &util::rm("$output_filestem.out") if (-e "$output_filestem.out");445 430 return 0; 446 431 } … … 466 451 } 467 452 468 469 453 # Convert a PDF file to text with the pdftotext command 470 454 … … 502 486 return 1; 503 487 } 504 505 488 506 489 # Convert a PostScript document to text with ps2ascii … … 560 543 561 544 sub any_to_html { 562 print STDERR "/;-Dg I am in any_to_html!\n";563 545 ($input_filename, $output_filestem) = @_; 564 546 … … 583 565 584 566 &util::rm("$output_filestem.text") if (-e "$output_filestem.text"); 585 print STDERR "/;-Dg I am getting out of any_to_html!\n";586 567 return 1; 587 568 } … … 625 606 return 1; 626 607 } 627 628 629
Note:
See TracChangeset
for help on using the changeset viewer.