Changeset 17328
- Timestamp:
- 2008-09-18T14:08:29+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/bin/script/pdfpstoimg.pl
r17326 r17328 4 4 ########################################################################### 5 5 # 6 # pdf toimg.pl -- convert PDFdocuments to various types of Image format6 # pdfpstoimg.pl -- convert PDF or PS documents to various types of Image format 7 7 # 8 8 # A component of the Greenstone digital library software … … 27 27 # 28 28 ########################################################################### 29 # pdftoimg.pl is a wrapper for running convert utility which converts 30 # PDF documents to various types of image (e.g. PNG, GIF, JPEG format, 31 # Then use PagedImgPlug to deal with the the images 29 # pdfpstoimg.pl is a wrapper for running the ImageMagick 'convert' utility 30 # which converts PDF and PS documents to various types of image (e.g. PNG, 31 # GIF, JPEG format). We then create an item file to join the images together 32 # into a document. The item file will be processed by PagedImagePlugin 32 33 33 34 BEGIN { … … 39 40 use util; 40 41 use Cwd; 41 use File::Basename 42 ; 42 use File::Basename; 43 43 44 sub print_usage { 44 # note - we don't actually ever use most of these options...45 45 print STDERR 46 ("pdf toimg.pl wrapper for pdftoimg.\n",47 "Usage: pdf toimg [options] <PDF-file> <output>>\n",46 ("pdfpstoimg.pl wrapper for converting PDF or PS files to a series of images.\n", 47 "Usage: pdfpstoimg.pl [options] <PDF/PS-file> <output-filestem>>\n", 48 48 "Options:\n", 49 "\t-convert_to\toutput image type for the PDF\n"49 "\t-convert_to\toutput image type (gif, jpg, png) \n" 50 50 ); 51 51 exit (1); … … 64 64 } 65 65 66 # Make sure the input file exists and can be opened for reading66 # Make sure the user has specified both input and output files 67 67 if (scalar(@ARGV) != 2) { 68 68 print_usage(); … … 73 73 74 74 # test that the directories exist to create the output file, or 75 # we should exit immediately. (File:: is included by util.pm)75 # we should exit immediately. 76 76 &util::mk_dir($output_filestem) if (!-e $output_filestem); 77 77 78 78 my @dir = split (/(\/|\\)/, $input_filename); 79 79 my $input_basename = pop(@dir); 80 $input_basename =~ s/\. pdf//i;80 $input_basename =~ s/\.(pdf|ps)$//i; 81 81 my $dir = join ("", @dir); 82 82 … … 89 89 # that the PATH is set up correctly. 90 90 $cmd = "convert"; 91 #if ($ENV{'GSDLOS'} =~ /^windows$/); 92 #Convert utility will convert the PDF to GIF Animation 91 93 92 my $output_filename = &util::filename_cat($output_filestem, $input_basename); 94 93 if ($convert_to eq "gif") {
Note:
See TracChangeset
for help on using the changeset viewer.