Changeset 35174
- Timestamp:
- 2021-05-20T15:10:20+12:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/gsConvert.pl
r32290 r35174 69 69 my $pdf_allow_images_only; 70 70 my $windows_scripting; 71 my $verbosity; 71 72 my $enc; 72 73 … … 92 93 print STDERR "\t\t-pdf_complex is set\n"; 93 94 print STDERR "\t-pdf_dpi\tSet the resolution in DPI of background images produced by xpdf's pdftohtml\n"; 95 print STDERR "\t-verbosity\tSet verbosity to 3 to see the commands that are run\n"; 94 96 exit(1); 95 97 } … … 97 99 my $faillogfile=""; 98 100 my $timeout=0; 99 my $verbosity=0;100 101 101 102 sub main 102 103 { 103 104 my (@ARGV) = @_; 104 my ($input_type,$output_type ,$verbose);105 my ($input_type,$output_type); 105 106 106 107 # Dynamically figure out what the --type option can support, based on whether -windows_scripting … … 126 127 'output/(auto|html|text|pagedimg).*/', \$output_type, # regex includes html_multi and (paged_)pretty_html besides html, as well as pagedimgtxt_<imgext> besides pagedimg_<imgext> 127 128 'timeout/\d+/0',\$timeout, 128 'verbos e/\d+/0', \$verbose,129 'verbosity/\d+/1', \$verbosity, 129 130 'windows_scripting',\$windows_scripting, 130 131 'use_strings', \$use_strings, … … 141 142 } 142 143 143 $verbosity=$verbose if defined $verbose;144 145 144 # Make sure the input file exists and can be opened for reading 146 145 if (scalar(@ARGV!=1)) { … … 454 453 if ($ENV{'GSDLOS'} !~ m/^windows$/i || $is_winnt_2000); 455 454 455 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 456 456 if (system($cmd) !=0) { 457 457 print STDERR "Powerpoint VB Scripting convert failed\n"; … … 472 472 473 473 # execute the command 474 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 474 475 $!=0; 475 476 if (system($cmd)!=0) … … 507 508 508 509 # execute the command 510 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 511 509 512 $!=0; 510 513 if (system($cmd)!=0) … … 586 589 587 590 # print STDERR "***** wvware launch cmd = $launch_cmd\n"; 591 print STDERR "gsConvert.pl: About to run cmd $launch_cmd\n" if $verbosity >2; 588 592 589 593 $wvware_status = system($launch_cmd)/256; … … 636 640 $cmd .= " 2> \"$output_filestem.err\"" 637 641 if ($ENV {'GSDLOS'} !~ m/^windows$/i || $is_winnt_2000); 638 #print STDERR "@@@@@@@@@ cmd=$cmd\n";639 642 640 643 # execute the command 644 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 645 641 646 $!=0; 642 647 if (system($cmd)!=0) … … 709 714 710 715 # execute the command 716 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 717 711 718 $!=0; 712 719 if (system($cmd)!=0) … … 831 838 } 832 839 840 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 833 841 $!=0; 834 835 842 my $retval=system($cmd); 836 843 if ($retval!=0) … … 913 920 } 914 921 915 #print STDERR "@@@@ Running command: $cmd\n"; 916 922 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 917 923 $!=0; 918 924 my $retval=system($cmd); … … 974 980 my $imagick_cmd = "\"".&util::get_perl_exec()."\" -S gs-magick.pl"; 975 981 $imagick_cmd = $imagick_cmd." --verbosity=$verbosity" if defined $verbosity; 982 print STDERR "gsConvert.pl: About to run cmd $imagick_cmd\n" if $verbosity >2; 976 983 my $result = `$imagick_cmd identify 2>&1`; 977 984 … … 1008 1015 # with quoting when GSDLHOME might contain spaces) but assume 1009 1016 # that the PATH is set up correctly 1017 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 1010 1018 $!=0; 1011 1019 my $retval=system($cmd); … … 1072 1080 $cmd .= " -nopgbrk"; 1073 1081 } 1074 1075 1076 1077 1078 1082 # Avoid the silly solitary carriage returns (CR in Notepad) at the end 1083 # of lines that ends up as \n appended to the doc title 1084 # by setting the end of line marker to unix style solitary newline (LF or \n), 1085 # which doesn't end up in the doc title 1086 $cmd .= " -eol unix"; 1079 1087 $cmd .= " \"$input_filename\" \"$output_filestem.text\""; 1080 1081 print STDERR "@@@@ Running command: $cmd\n"; 1082 1083 return _run_pdf_to_text_cmd($cmd, $output_filestem); 1088 1089 return _run_pdf_to_text_cmd($cmd, $output_filestem); 1084 1090 } 1085 1091 … … 1091 1097 my $cmd = "pdftotext \"$input_filename\" \"$output_filestem.text\""; 1092 1098 1093 1099 return _run_pdf_to_text_cmd($cmd, $output_filestem); 1094 1100 } 1095 1101 1096 1102 sub _run_pdf_to_text_cmd { 1097 1103 my ($cmd, $output_filestem) = @_; 1098 1104 1099 1105 if ($ENV{'GSDLOS'} !~ m/^windows$/i) { … … 1102 1108 $cmd .= " > \"$output_filestem.err\""; 1103 1109 } 1104 1110 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 1105 1111 if (system($cmd)!=0) 1106 1112 { … … 1178 1184 #$cmd .= "pstotext -output \"$output_filestem.text\" $input_filename\""; 1179 1185 $cmd .= " 2> $output_filestem.err"; 1186 1187 print STDERR "gsConvert.pl: About to run cmd $cmd\n" if $verbosity >2; 1180 1188 $!=0; 1181 1182 1189 my $retcode=system($cmd); 1183 1190 $retcode = $? >> 8; # see man perlfunc - system for this...
Note:
See TracChangeset
for help on using the changeset viewer.