Changeset 17328


Ignore:
Timestamp:
2008-09-18T14:08:29+12:00 (16 years ago)
Author:
kjdon
Message:

tidied up this file a bit, and changed all pdf help bits to pdf/ps help. This is a result of the merge of pdftoimg.pl and pstoimg.pl. Basically only the output statements have changed, the code was pretty much all the same

File:
1 edited

Legend:

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

    r17326 r17328  
    44###########################################################################
    55#
    6 # pdftoimg.pl -- convert PDF documents to various types of Image format
     6# pdfpstoimg.pl -- convert PDF or PS documents to various types of Image format
    77#
    88# A component of the Greenstone digital library software
     
    2727#
    2828###########################################################################
    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
    3233
    3334BEGIN {
     
    3940use util;
    4041use Cwd;
    41 use File::Basename
    42 ;
     42use File::Basename;
     43
    4344sub print_usage {
    44     # note - we don't actually ever use most of these options...
    4545    print STDERR 
    46     ("pdftoimg.pl wrapper for pdftoimg.\n",
    47      "Usage: pdftoimg [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",
    4848     "Options:\n",
    49      "\t-convert_to\toutput image type for the PDF\n"
     49     "\t-convert_to\toutput image type (gif, jpg, png) \n"
    5050     );
    5151    exit (1);
     
    6464    }
    6565   
    66     # Make sure the input file exists and can be opened for reading
     66    # Make sure the user has specified both input and output files
    6767    if (scalar(@ARGV) != 2) {
    6868    print_usage();
     
    7373   
    7474    # 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.
    7676    &util::mk_dir($output_filestem) if (!-e $output_filestem);
    7777       
    7878    my @dir = split (/(\/|\\)/, $input_filename);
    7979    my $input_basename = pop(@dir);
    80     $input_basename =~ s/\.pdf//i;
     80    $input_basename =~ s/\.(pdf|ps)$//i;
    8181    my $dir = join ("", @dir);
    8282
     
    8989    # that the PATH is set up correctly.
    9090    $cmd = "convert";
    91     #if ($ENV{'GSDLOS'} =~ /^windows$/);
    92     #Convert utility will convert the PDF to GIF Animation
     91
    9392    my $output_filename = &util::filename_cat($output_filestem, $input_basename);
    9493    if ($convert_to eq "gif") {
Note: See TracChangeset for help on using the changeset viewer.