Source

IDO / perl / pdf-pages.pl

The default branch has multiple heads

Full commit
# -*- perl -*- ###############################################################
#
#  			Copyright 2009 Potsdam University.
#			      All Rights Reserved
#
#
#  System        : 
#  Module        : 
#  Object Name   : $RCSfile:$
#  Revision      : $Revision:$
#  Date          : $Date:$
#  Author        : $Author:$
#  Created By    : Dr. Detlef Groth
#  Created       : Tue Mar 31 11:36:50 2009
#  Last Modified : <090503.0724>
#
#  Description	
#
#  Notes
#
#  History
#	
##############################################################################
#
#  Copyright (c) 2009 Potsdam University.
# 
#  All Rights Reserved.
# 
#  This  document  may  not, in  whole  or in  part, be  copied,  photocopied,
#  reproduced,  translated,  or  reduced to any  electronic  medium or machine
#  readable form without prior written consent from Potsdam University.
#
##############################################################################
use strict;
use PDF::Reuse;
sub drawLine {
    my $x1 = shift ;
    my $y1 = shift ;
    my $x2 = shift;
    my $y2 = shift;
    my $col = shift || "0.1 0.1 0.1";
    my $lw = shift || 0.5 ;
    my $dashed = shift;
    prAdd("$col RG\n");
    prAdd("$lw w\n");
    if ($dashed) {
        prAdd("[2 2] 0 d\n"); # a dashed line 0.5 points large
    }
    prAdd("$x1 $y1 m\n");
    prAdd("$x2 $y2 l\n");
    prAdd("S\n"); 
    if ($dashed) {
        prAdd("[] 0 d\n"); # reset dash
    }
    
    
}
sub drawImage {
   my $file = shift;
   my $info = image_info($file);
   my ($width, $height) = dim($info);    # Get the dimensions
   my $intName = prJpeg("$file",         # Define the image 
                         $width,         # in the document
                         $height);
   my $str = "q\n";
   $str   .= "$width 0 0 $height 200 400 cm\n";
   $str   .= "/$intName Do\n";
   $str   .= "Q\n";
   prAdd($str);
}
my $file = shift ;
my $karo = shift ;
sub main {
    my $karo = shift ;
    foreach my $i (2..26) {
        drawLine(40,$i*30,560,$i*30,"0.5 0.5 0.5",0.5,1);
    }
    if ($karo) {
        foreach my $j (1..21) {
            drawLine(30*$j,60,30*$j,780,"0.5 0.5 0.5",0.5,1);
        }
    }
}
prFile($file);

prFont('Times-Bold');
for my $x (0..3) {
    main($karo);
    prPage();
}
#drawImage("idoinsigno.jpg");
prEnd();
exit 0 ;
__DATA__