+++ /dev/null
-#!/usr/bin/perl
-use KCatch;
-use utf8;
-use Encode 'decode';
-use File::Basename;
-use warnings;
-use CGI;
-use CGI::Carp qw(fatalsToBrowser);
-
-$cgi = new CGI;
-$pdfpath = decode('utf-8',$cgi->param('pdfpath'));
-$pagenum = int($cgi->param('pagenum'));
-$pagediff = int($cgi->param('pagediff'));
-$dpi = int($cgi->param('dpi'));
-
-$outputpath = "/tmp/rec10pdf/" . basename($pdfpath);
-if (-e "/tmp/rec10pdf"){
- #"";
-}else{
- system "mkdir /tmp/rec10pdf";
-}
-if ((-e $pdfpath)&&(-r $pdfpath)){
- $b = $pagenum-$pagediff;
- $e = $pagenum+$pagediff;
- if ($b<1){
- $b = 1;
- }
- system "pdftk \"" . $pdfpath . "\" cat " . $b . "-" . $e . " output \"" . $outputpath . "\""
-}
-if (-e $outputpath){
- $size = -s $outputpath;
- print "Content-type: application/pdf\n";
- print "Content-length:",$size,"\n";
- print "\n";
- open(IN,$outputpath);
- binmode(IN);
- binmode(STDOUT);
- #read(IN,$buf,$size);
- while(read(IN,$buf,1048576)){
- print $buf;
- }
- close(IN);
- system "rm " . $outputpath;
-
-}else{
-print $cgi->header(-type=>"text/html",-charset=>"utf-8");
-print $cgi->start_html(-title=>"rec10 pdf search",-lang=>"ja-JP");
-print "error<br>";
-print "pdftk \"" . $pdfpath . "\" cat " . $b . "-" . $e . " output \"/tmp/rec10pdf/" . basename($pdfpath) . "\"";
-}