Posted By

rubinsta on 09/16/08


Tagged

pdf perl Yiddish


Versions (?)

Tiff2PDF converter for NYBC Files


 / Published in: Perl
 

Used for converting, compiling, and reversing tiff files from the Book Center's digital library.

  1. #!/usr/bin/env perl
  2.  
  3. use warnings;
  4. use strict;
  5. use Getopt::Std;
  6. use PDF::FromImage;
  7.  
  8. our %opts;
  9.  
  10. getopt('d:f:o:', \%opts);
  11.  
  12. if (!%opts) {
  13.  
  14. print STDERR << "EOF";
  15.  
  16.  Usage: [-d directory][-f image file] -o output.pdf
  17.  
  18. EOF
  19. }
  20.  
  21. elsif ($opts{d}) {
  22.  
  23. my $pdf = PDF::FromImage->new;
  24.  
  25. my @files = <$opts{d}/*.tif>;
  26.  
  27. my @rfiles = reverse(@files);
  28.  
  29. $pdf->load_images(@rfiles);
  30.  
  31. $pdf->write_file("$opts{o}");
  32. }
  33.  
  34. if ($opts{f}) {
  35. my $pdf = PDF::FromImage->new;
  36.  
  37. $pdf->load_images("$opts{f}");
  38.  
  39. $pdf->write_file("$opts{o}");
  40. }

Report this snippet  

You need to login to post a comment.