sub pdf_delete_previous_pdf {

my ($pdfpath) = @_ ;

opendir(DIR, "$pdfpath") or die "cant open Directory $pdfpath: $!\n";

while(defined($folder = readdir(DIR))) {
    if (length $folder > 2) {
        my ($file,$type) = split(/\./,$folder) ;
        if (-e "$pdfpath/$file.pdf"){
            unlink ("$pdfpath/$file.pdf") or print "unable to unlink - $pdfpath/$file.pdf : $!";
            }
        }
    }

closedir(DIR) ;

} #------------------------------------------------------------------------------------

sub pdf_initialise {

my ($folder,$file,$title) = @_ ;

my $pdf_file = "$folder/$file";

$pdf = PDF::API2 -> new(-file => $pdf_file);

%font = (
    Helvetica => {
        Oblique => $pdf->corefont('Helvetica-Oblique',  -encoding => 'latin1'),
        Bold    => $pdf->corefont('Helvetica-Bold',    -encoding => 'latin1'),
        Normal  => $pdf->corefont('Helvetica',         -encoding => 'latin1'),
        },
    Verdana => {
        Bold   => $pdf->corefont('Verdana-Bold',      -encoding => 'Western'),
        Normal => $pdf->corefont('Verdana',           -encoding => 'Western'),
        },
    Courier => {
        Bold   => $pdf->corefont('Courier-Bold',      -encoding => 'latin1'),
        Normal => $pdf->corefont('Courier',           -encoding => 'latin1'),
    },
    );

$pdf->info(
        'Author'       => "ITV",
        'Creator'      => "ITV",
        'Producer'     => "ITV",
        'Title'        => $title,
        'Subject'      => $title,
        'Keywords'     => $title
    );

} #-------------------------------------------------------------------------------

sub pdf_initialise_page {

if ($layout eq 'landscape'){
    $page = $pdf->page;
    $page->mediabox(297/mm, 210/mm);
    }
elsif ($layout eq 'label'){
    $page = $pdf->page;
    $page->mediabox(100/mm, 100/mm);
    }
else 
    {
    $page = $pdf->page;
    $page->mediabox(210/mm, 297/mm);
    }
   

$small_oblique_text = $page->text;
$small_oblique_text->font( $font{'Helvetica'}{'Oblique'}, 8/pt );
$small_oblique_text->fillcolor( 'black' );

$medium_oblique_text = $page->text;
$medium_oblique_text->font( $font{'Helvetica'}{'Oblique'}, 10/pt );
$medium_oblique_text->fillcolor( 'black' );

   
$bar_head_bold_text = $page->text;
$bar_head_bold_text->font( $font{'Helvetica'}{'Bold'}, 13/pt );
$bar_head_bold_text->fillcolor( 'white' );

$xx_large_bold_text = $page->text;
$xx_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 16/pt );
$xx_large_bold_text->fillcolor( 'black' );

$xxx_large_bold_text = $page->text;
$xxx_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 24/pt );
$xxx_large_bold_text->fillcolor( 'black' );

$xx_large_italic_text = $page->text;
$xx_large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 16/pt );
$xx_large_italic_text->fillcolor( 'black' );

$xx_large_text = $page->text;
$xx_large_text->font( $font{'Helvetica'}{'Normal'}, 16/pt );
$xx_large_text->fillcolor( 'black' );  
  
$x_large_bold_text = $page->text;
$x_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 14/pt );
$x_large_bold_text->fillcolor( 'black' );

$x_large_italic_text = $page->text;
$x_large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 14/pt );
$x_large_italic_text->fillcolor( 'black' );

$x_large_text = $page->text;
$x_large_text->font( $font{'Helvetica'}{'Normal'}, 14/pt );
$x_large_text->fillcolor( 'black' );

$large_bold_text = $page->text;
$large_bold_text->font( $font{'Helvetica'}{'Bold'}, 12/pt );
$large_bold_text->fillcolor( 'black' );

$large_italic_text = $page->text;
$large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 12/pt );
$large_italic_text->fillcolor( 'black' );

$large_text = $page->text;
$large_text->font( $font{'Helvetica'}{'Normal'}, 12/pt );
$large_text->fillcolor( 'black' );

$medium_bold_text = $page->text;
$medium_bold_text->font( $font{'Helvetica'}{'Bold'}, 9.5/pt );
$medium_bold_text->fillcolor( 'black' );

$medium_italic_text = $page->text;
$medium_italic_text->font( $font{'Helvetica'}{'Oblique'}, 10/pt );
$medium_italic_text->fillcolor( 'black' );

$medium_text = $page->text;
$medium_text->font( $font{'Helvetica'}{'Normal'}, 9/pt );
$medium_text->fillcolor( 'black' );

$medium_red_bold_text = $page->text;
$medium_red_bold_text->font( $font{'Helvetica'}{'Bold'}, 8/pt );
$medium_red_bold_text->fillcolor( 'red' );

$small_text = $page->text;
$small_text->font( $font{'Helvetica'}{'Normal'}, 8/pt );
$small_text->fillcolor( 'black' );

$small_blue_text = $page->text;
$small_blue_text->font( $font{'Helvetica'}{'Normal'}, 8/pt );
$small_blue_text->fillcolor( 'blue' );

$small_bold_text = $page->text;
$small_bold_text->font( $font{'Helvetica'}{'Bold'}, 8/pt );
$small_bold_text->fillcolor( 'black' );

$small_italic_text = $page->text;
$small_italic_text->font( $font{'Helvetica'}{'Oblique'}, 8/pt );
$small_italic_text->fillcolor( 'black' );

$tiny_text = $page->text;
$tiny_text->font( $font{'Helvetica'}{'Normal'}, 7/pt );
$tiny_text->fillcolor( 'black' );

$tiny_bold_text = $page->text;
$tiny_bold_text->font( $font{'Helvetica'}{'Bold'}, 7/pt );
$tiny_bold_text->fillcolor( 'black' );

$tiny_italic_text = $page->text;
$tiny_italic_text->font( $font{'Helvetica'}{'Oblique'}, 7/pt );
$tiny_italic_text->fillcolor( 'black' );

$grey_text_above_right = $page -> text;
$grey_text_above_right -> font($font{'Helvetica'}{'Normal'}, 9/pt);
$grey_text_above_right -> fillcolor('#808080');

$small_bold_text_white = $page->text;
$small_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 8/pt );
$small_bold_text_white->fillcolor( 'white' );

$small_medium_bold_text_white = $page->text;
$small_medium_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 9/pt );
$small_medium_bold_text_white->fillcolor( 'white' );

$medium_bold_text_white = $page->text;
$medium_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 10/pt );
$medium_bold_text_white->fillcolor( 'white' );

$large_bold_text_white = $page->text;
$large_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 12/pt );
$large_bold_text_white->fillcolor( 'white' );

$medium_green_text = $page->text;
$medium_green_text->font( $font{'Helvetica'}{'Normal'}, 10/pt );
$medium_green_text->fillcolor( 'green' );


if ($blue_box) { 
	$up = 292 ;
	&pdf_box_block_top(5,205,'#009bc8') ; # start block -------------------------------------
}

if ($inner_blue_box) { 
	$up  = 287 ;
	$top = $up;
	&pdf_box_block_top($blocks[1],200,'#009bc8') ; # start block -------------------------------------
}

} #-------------------------------------------------------------------------------

sub finish_pdf {

$pdf->save;
$pdf->end();

} #-------------------------------------------------------------------------------

sub pdf_page_header {

$page_num++ ;

# my $image1 = $page->gfx(1) ;
# my $image1_thumb = "$htmlpath/img/pdf_logo.jpg";
# $pdf_image1_file = $pdf->image_jpeg($image1_thumb);
# $image1->image($pdf_image1_file, $across/mm, $up/mm, 80/mm, 19/mm);

my $image1 = $page->gfx(1) ;
my $image1_thumb = "$htmlpath/img/pdf_logo.png";
$pdf_image1_file = $pdf->image_png($image1_thumb);
$image1->image($pdf_image1_file, 10/mm, $up/mm, 90/mm, 29/mm);

$up+=26 ;

&pdf_grey_text_above_right (198,$up,"$useropts{company}") ;
&pdf_nl_s;
&pdf_grey_text_above_right (198,$up,"Co Reg: $useropts{co_reg}") ;
&pdf_nl_s;
&pdf_grey_text_above_right (198,$up,"Vat Reg: $useropts{vat_nr}") ;
&pdf_nl_s;
&pdf_grey_text_above_right (198,$up,"$useropts{address1}") ;
&pdf_nl_s;
&pdf_grey_text_above_right (198,$up,"$useropts{address2}, $useropts{address3}, $useropts{city}") ;
&pdf_nl_s;
&pdf_grey_text_above_right (198,$up,"South Africa") ;
&pdf_nl_s;
&pdf_grey_text_above_right (198,$up,"Tel: $useropts{tel}") ;
&pdf_nl_s;

} #-------------------------------------------------------------------------------

sub pdf_footer {
 
$up = 10 ;

&pdf_black_line ;
&pdf_tiny_text (50, 5, "Johannesburg: $useropts{tel}, Email: $useropts{email}") ;

} #-------------------------------------------------------------------------------

sub pdf_text_block {

my ($along,$text_block,$tlock_length,$grid) = @_ ;

my $lines = 1;

# $max_text_length = 120 unless $max_text_length ;

$text_block =~ s/\n/ <br>/g;
$text_block = substr($text_block,0,-4) if substr($text_block,-4,4) eq '<br>' ;

my @words_array = split (/ /, $text_block) ;
my $wrapped_line   = '' ;
my $block_start_up = $up ;
my $tlock_length_orig = $tlock_length ; 
my $word_cnt = 0 ; 

foreach my $word (@words_array) {
    my $word_length = length($word) ;
    my $wrapped_line_length = length($wrapped_line) ;
	$tlock_length-- if $word eq uc $word ;
	$word_length -= 4 if $word =~ /<br>/ ;
    if (($wrapped_line_length + $word_length) > $tlock_length or $word =~ /<br>/) { 
		$word =~ s/<br>//g if $word =~ /<br>/ ;
		$tlock_length = $tlock_length_orig ;
        &pdf_text_block_line($along,$grid,$wrapped_line) ;
        if ($grid == 1 or $grid == 2) {
			&pdf_nl_gr ; 
		} elsif ($grid == 6) {
			$up -= 3.25 ;
		} else { 
			&pdf_nl_s ; 
		}        
        $lines++;
        $wrapped_line = '' ;
	}
	$word_cnt++ ;
    $wrapped_line .= $word . ' ' ;
}
    
&pdf_text_block_line($along,$grid,$wrapped_line) ;

if ($grid == 2) { 
    &pdf_nl_t; 
    }
elsif ($grid == 1) { 
    $up = $block_start_up ; 
    }
elsif ($grid == 5) {
    &pdf_nl_gr;
    }
elsif ($grid == 6) {
	$up -= 1.25 ;
} else { 
   &pdf_nl_s; 
   #$up = $up - 8;
    }

return ($lines) ;

} #----------------------------------------------------------------------------------------------------

sub pdf_text_block_line {

my ($along,$grid,$wrapped_line) = @_ ;

if ($grid == 1) { 
    &pdf_tiny_text  ($along,$up,$wrapped_line) ; 
    } 
elsif ($grid == 2) { 
    &pdf_tiny_bold_text  ($along,$up,$wrapped_line) ; 
    } 
elsif ($grid == 3) { 
    &pdf_medium_text  ($along,$up,$wrapped_line) ; 
    } 
elsif ($grid == 4) { 
    &pdf_small_bold_text  ($along,$up,$wrapped_line) ; 
    } 
else 
    { 
    &pdf_small_text  ($along,$up,$wrapped_line) ; 
    }  
    
} #-------------------------------------------------------------------------------

sub pdf_text_center {

my ($text,$along,$colwidth) = @_ ;

my $width = $tiny_text->advancewidth($text);

$width-=$colwidth ;

$tiny_text->translate( $along/mm, $up/mm ); 
$tiny_text->text($text,-indent=>-($width/2));

} #----------------------------------------------------------------------------------------------------

sub pdf_check_value_of_up {

my ($value) = @_ ;

if ($up < $value) {
    if ($blue_box) { 
		$up=5;
		&pdf_box_block_bottom(5,205,'#009bc8') ; # end block -------------------------------------
	}
	 if ($inner_blue_box) { 
		$up=10;
		&vertical_lines_inner_box;
		&pdf_box_block_bottom($blocks[1],200,'#009bc8') ; # end block -------------------------------------		
	}	
	
	&pdf_initialise_page ;
    if ($layout eq 'landscape') {
        $up     = 195 ;
        $across = 1 ;
        &pdf_black_line(10,$up,287,$up) ; # horizontal
        }
    elsif ($label) {
        $label_height = '' ;
        $up     = 287 ;
        }
    else
        {
        $up     = 272 ;
        $across = 1 ;
        }
    # &pdf_page_header ;
    }

} #----------------------------------------------------------------------------------------------------

sub pdf_nl_tt {

$up = $up - 2 ;
# &pdf_check_value_of_up(20) ;

} #-------------------------------------------------------------------------------

sub pdf_nl_gr {

$up = $up - 2.7 ;

} #-------------------------------------------------------------------------------

sub pdf_nl_t {

$up = $up - 3 ;
# &pdf_check_value_of_up(20) ;

} #-------------------------------------------------------------------------------

sub pdf_nl_s {

$up = $up - 4 ;
# &pdf_check_value_of_up(20) ;

} #-------------------------------------------------------------------------------

sub pdf_nl {

$up = $up - 5 ;
# &pdf_check_value_of_up(20) ;

} #-------------------------------------------------------------------------------

sub pdf_nl_gap_1 {

$up = $up - 6 ;
# &pdf_check_value_of_up(20) ;

} #-------------------------------------------------------------------------------

sub pdf_nl_gap_2 {

$up = $up - 7 ;
# &pdf_check_value_of_up(20) ;

} #-------------------------------------------------------------------------------

sub pdf_nl_gap_3 {

$up = $up - 8 ;
# &pdf_check_value_of_up(20) ;

} #-------------------------------------------------------------------------------

sub pdf_dashed_line {

my ($start,$length) = @_ ;

unless ($start)  { $start  = 10 ; }
unless ($length) { $length = 200 ; }

my $dashed_line = $page->gfx(1);
$dashed_line->strokecolor( 'black' );
$dashed_line->linewidth( '0.5' );
$dashed_line->linedash(3,4);
$dashed_line->move($start/mm,$up/mm); 
$dashed_line->line($length/mm,$up/mm); 
$dashed_line->stroke;

} #-------------------------------------------------------------------------------

sub pdf_grey_line {

my ($start,$end) = @_ ;

my $grey_line = $page->gfx(1);
$grey_line->strokecolor( 'grey' );
$grey_line->linewidth( '0.8' );
$grey_line->linedash();
$grey_line->move( $start/mm, ($up/mm) ); $grey_line->line($end/mm, ($up/mm) ); $grey_line->stroke;

} #-------------------------------------------------------------------------------

sub pdf_black_line {

my ($x1,$y1,$x2,$y2) = @_ ;

unless ($x1)  { $x1  = 10  ; }
unless ($y1)  { $y1  = $up ; }
unless ($x2)  { $x2  = 200 ; }
unless ($y2)  { $y2  = $up ; }

my $pdf_black_line = $page->gfx(1);
$pdf_black_line->strokecolor( 'black' );
$pdf_black_line->linewidth( '0.5' );
$pdf_black_line->linedash();
$pdf_black_line->move($x1/mm,$y1/mm); 
$pdf_black_line->line($x2/mm,$y2/mm); 
$pdf_black_line->stroke;

} #-------------------------------------------------------------------------------

sub pdf_bar {

my ($x1,$y1,$x2,$y2,$cl,$tx,$lw,$txa,$size,$text_color,$cnt_lines,$max_text_length) = @_ ;  # &pdf_bar(10,$up,200,$up,'#009bc8','Quote',5) ;

unless ($x1)   { $x1   = 10      ; }
unless ($y1)   { $y1   = $up     ; }
unless ($x2)   { $x2   = 200     ; }
unless ($y2)   { $y2   = $up     ; }

unless ($cl)   { $cl   = 'black' ; }
unless ($lw)   { $lw   = 5       ; }
# unless ($txcl) { $txcl = 'white' ; }

my $pdf_black_line = $page->gfx(1);
$pdf_black_line->strokecolor($cl);
$pdf_black_line->linewidth($lw);
$pdf_black_line->linedash();
$pdf_black_line->move($x1/mm,$y1/mm); 
$pdf_black_line->line($x2/mm,$y2/mm); 
$pdf_black_line->stroke;

if (not $size and not $text_color)                 													{ &pdf_bar_head_bold_text($txa,$up-1.5,$tx) ; } # default to large text
elsif ($size eq 'med' and not $text_color)         													{ &pdf_medium_white_text_bold($txa,$up-1,$tx) ; }
elsif ($size eq 'small' and not $text_color)       													{ &pdf_small_medium_white_text_bold($txa,$up-1,$tx) ; }
elsif ($size eq 'med_right' and not $text_color)   													{ &pdf_medium_white_text_bold_right($txa,$up-1,$tx) ; } # medium text
elsif ($size eq 'small_right' and not $text_color) 													{ &pdf_small_medium_white_text_bold_right($txa,$up-1,$tx) ; }
elsif ($size eq 'small' and $text_color eq 'small_black' and ($cnt_lines == 1 or not $cnt_lines))	{ &pdf_small_text($txa,$up,$tx) ; }
elsif ($size eq 'small' and $text_color eq 'small_black' and $cnt_lines >= 1)						{ &pdf_text_block($txa,$tx,$max_text_length,6) ; }
					
} #-------------------------------------------------------------------------------

#------------------------------------------------------------------------------ added by handre
sub pdf_extra_thin_black_line {

my ($x1,$y1,$x2,$y2,$color) = @_ ; 

$color = 'black' if not $color ;  # $color = '#009bc8' ;

unless ($x1)  { $x1  = 10  ; }
unless ($y1)  { $y1  = $up ; }
unless ($x2)  { $x2  = 200 ; }
unless ($y2)  { $y2  = $up ; }

my $pdf_black_line = $page->gfx(1);
$pdf_black_line->strokecolor($color);
$pdf_black_line->linewidth( '0.5' );
$pdf_black_line->linedash();
$pdf_black_line->move($x1/mm,$y1/mm); 
$pdf_black_line->line($x2/mm,$y2/mm); 
$pdf_black_line->stroke;

} #-------------------------------------------------------------------------------

sub pdf_thin_box_block_top {
	
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;

$box_start{$st} = $up ;

&pdf_extra_thin_black_line($st,$up,$en,$up,$color) ; # horizontal

} #-------------------------------------------------------------------------------

sub pdf_thin_box_block_bottom {
	
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;

&pdf_extra_thin_black_line($st,$up,$en,$up,$color) ; # horizontal

&pdf_extra_thin_black_line ($st,$box_start{$st},$st,$up,$color) ; # vertical
&pdf_extra_thin_black_line ($en,$box_start{$st},$en,$up,$color) ; # vertical

} #-------------------------------------------------------------------------------

#------------------------------------------------------------------------------------- added by handre


sub pdf_thin_black_line {

my ($x1,$y1,$x2,$y2,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;

unless ($x1)  { $x1  = 10  ; }
unless ($y1)  { $y1  = $up ; }
unless ($x2)  { $x2  = 200 ; }
unless ($y2)  { $y2  = $up ; }

my $pdf_black_line = $page->gfx(1);
$pdf_black_line->strokecolor($color);
$pdf_black_line->linewidth( '1.5' );
$pdf_black_line->linedash();
$pdf_black_line->move($x1/mm,$y1/mm); 
$pdf_black_line->line($x2/mm,$y2/mm); 
$pdf_black_line->stroke;

} #-------------------------------------------------------------------------------

sub pdf_curr_symbols {

$curr_symb{ZAR} = 'R';
$curr_symb{USD} = '$';
# $curr_symb{GBP} = '£';
$curr_symb{GBP} = 'GBP';
# $curr_symb{EUR} = '€';
$curr_symb{EUR} = 'EUR';

} #------------------------------------------------------------------------------------

sub pdf_box_block_top {
	
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;

$box_start{$st} = $up ;

&pdf_thin_black_line($st,$up,$en,$up,$color) ; # horizontal

} #-------------------------------------------------------------------------------

sub pdf_box_block_bottom {
	
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;

&pdf_thin_black_line($st,$up,$en,$up,$color) ; # horizontal

&pdf_thin_black_line ($st,$box_start{$st},$st,$up,$color) ; # vertical
&pdf_thin_black_line ($en,$box_start{$st},$en,$up,$color) ; # vertical

} #-------------------------------------------------------------------------------

sub pdf_rounded_half_page_block_top {
	
my ($color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;

$box_start = $up ;

$pdf_rounded_half_page_block = $page->gfx(1);
$pdf_rounded_half_page_block->strokecolor( 'black' );
$pdf_rounded_half_page_block->linewidth( '0.5' );
$pdf_rounded_half_page_block->linedash();
$pdf_rounded_half_page_block->move(14/mm,($up/mm) ); 
$pdf_rounded_half_page_block->line(196/mm,($up/mm) ); 
$curve = $up-4 ;
$pdf_rounded_half_page_block->curve(196/mm,($up/mm),200/mm,($up/mm),200/mm,($curve/mm)) ;
$up-=4 ;

} #-------------------------------------------------------------------------------

sub pdf_rounded_half_page_block_rest {

$box_up = $up + 3 ;

$pdf_rounded_half_page_block->line(200/mm,($box_up/mm) );
$curve = $box_up-4 ;
$pdf_rounded_half_page_block->curve(200/mm,($box_up/mm),200/mm,($curve/mm),196/mm,($curve/mm)) ;
$box_up-=4 ;
$pdf_rounded_half_page_block->move(196/mm,($box_up/mm) );
$pdf_rounded_half_page_block->line(14/mm,($box_up/mm) );
$curve = $box_up+4 ;
$pdf_rounded_half_page_block->curve(14/mm,($box_up/mm),10/mm,($box_up/mm),10/mm,($curve/mm)) ;
$box_up+=4 ;
$pdf_rounded_half_page_block->move(10/mm,($box_up/mm) );
$box_up = $box_start-4 ;
$pdf_rounded_half_page_block->line(10/mm,($box_up/mm) );
$curve = $box_up+4 ;
$pdf_rounded_half_page_block->curve(10/mm,($box_up/mm),10/mm,($curve/mm),14/mm,($curve/mm)) ;
$pdf_rounded_half_page_block->stroke;

} #-------------------------------------------------------------------------------

# sub pdf_rounded_half_page_block {

# my $pdf_rounded_half_page_block = $page->gfx(1);
# $pdf_rounded_half_page_block->strokecolor( 'black' );
# $pdf_rounded_half_page_block->linewidth( '0.5' );
# $pdf_rounded_half_page_block->linedash();
# $pdf_rounded_half_page_block->move(14/mm,($up/mm) ); 
# $pdf_rounded_half_page_block->line(196/mm,($up/mm) ); 
# $curve = $up-4 ;
# $pdf_rounded_half_page_block->curve(196/mm,($up/mm),200/mm,($up/mm),200/mm,($curve/mm)) ;
# $up-=4 ;
# $pdf_rounded_half_page_block->move(200/mm,($up/mm) );
# $up-=106 ;
# $pdf_rounded_half_page_block->line(200/mm,($up/mm) );
# $curve = $up-4 ;
# $pdf_rounded_half_page_block->curve(200/mm,($up/mm),200/mm,($curve/mm),196/mm,($curve/mm)) ;
# $up-=4 ;
# $pdf_rounded_half_page_block->move(196/mm,($up/mm) );
# $pdf_rounded_half_page_block->line(14/mm,($up/mm) );
# $curve = $up+4 ;
# $pdf_rounded_half_page_block->curve(14/mm,($up/mm),10/mm,($up/mm),10/mm,($curve/mm)) ;
# $up+=4 ;
# $pdf_rounded_half_page_block->move(10/mm,($up/mm) );
# $up+=106 ;
# $pdf_rounded_half_page_block->line(10/mm,($up/mm) );
# $curve = $up+4 ;
# $pdf_rounded_half_page_block->curve(10/mm,($up/mm),10/mm,($curve/mm),14/mm,($curve/mm)) ;
# $pdf_rounded_half_page_block->stroke;
# $up-=110 ;

# } #-------------------------------------------------------------------------------

sub pdf_xx_large_text {

my ($along, $up, $text) = @_ ; $xx_large_text->translate( $along/mm, $up/mm ); $xx_large_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_xxx_large_bold_text {

my ($along, $up, $text) = @_ ; $xxx_large_bold_text->translate( $along/mm, $up/mm ); $xxx_large_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------


sub pdf_xx_large_bold_text {

my ($along, $up, $text) = @_ ; $xx_large_bold_text->translate( $along/mm, $up/mm ); $xx_large_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_xx_large_italic_text {

my ($along, $up, $text) = @_ ; $xx_large_italic_text->translate( $along/mm, $up/mm ); $xx_large_italic_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_x_large_text {

my ($along, $up, $text) = @_ ; $x_large_text->translate( $along/mm, $up/mm ); $x_large_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_x_large_bold_text {

my ($along, $up, $text) = @_ ; $x_large_bold_text->translate( $along/mm, $up/mm ); $x_large_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_x_large_italic_text {

my ($along, $up, $text) = @_ ; $x_large_italic_text->translate( $along/mm, $up/mm ); $x_large_italic_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_large_text {

my ($along, $up, $text) = @_ ; $large_text->translate( $along/mm, $up/mm ); $large_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_large_bold_text {

my ($along, $up, $text) = @_ ; $large_bold_text->translate( $along/mm, $up/mm ); $large_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_large_italic_text {

my ($along, $up, $text) = @_ ; $large_italic_text->translate( $along/mm, $up/mm ); $large_italic_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_medium_text {

my ($along, $up, $text) = @_ ; $medium_text->translate( $along/mm, $up/mm ); $medium_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_medium_bold_text {

my ($along, $up, $text) = @_ ; $medium_bold_text->translate( $along/mm, $up/mm ); $medium_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_medium_italic_text {

my ($along, $up, $text) = @_ ; $medium_italic_text->translate( $along/mm, $up/mm ); $medium_italic_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_bar_head_bold_text {

my ($along, $up, $text) = @_ ; $bar_head_bold_text->translate( $along/mm, $up/mm ); $bar_head_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_medium_red_bold_text {

my ($along, $up, $text) = @_ ; $medium_red_bold_text->translate( $along/mm, $up/mm ); $medium_red_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_medium_bold_text_right {

my ($along, $up, $text) = @_ ; $medium_bold_text->translate( $along/mm, $up/mm ) ; $medium_bold_text->text_right( $text ) ;

} #----------------------------------------------------------------------------------------------------

sub pdf_small_text {

my ($along, $up, $text) = @_ ; $small_text->translate( $along/mm, $up/mm ); $small_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_small_blue_text {

my ($along, $up, $text) = @_ ; $small_blue_text->translate( $along/mm, $up/mm ); $small_blue_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_small_bold_text {

my ($along, $up, $text) = @_ ; $small_bold_text->translate( $along/mm, $up/mm ); $small_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_small_italic_text {

my ($along, $up, $text) = @_ ; $small_italic_text->translate( $along/mm, $up/mm ); $small_italic_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_small_text_right {

my ($along, $up, $text) = @_ ; $small_text->translate( $along/mm, $up/mm ) ; $small_text->text_right( $text ) ;

} #----------------------------------------------------------------------------------------------------

sub pdf_small_bold_text_right {

my ($along, $up, $text) = @_ ; $small_bold_text->translate( $along/mm, $up/mm ) ; $small_bold_text->text_right( $text ) ;

} #----------------------------------------------------------------------------------------------------

sub pdf_tiny_text {

my ($along, $up, $text) = @_ ; $tiny_text->translate( $along/mm, $up/mm ); $tiny_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_tiny_bold_text {

my ($along, $up, $text) = @_ ; $tiny_bold_text->translate( $along/mm, $up/mm ); $tiny_bold_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_tiny_italic_text {

my ($along, $up, $text) = @_ ; $tiny_italic_text->translate( $along/mm, $up/mm ); $tiny_italic_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_tiny_text_right {

my ($along, $up, $text) = @_ ; $tiny_text->translate( $along/mm, $up/mm ) ; $tiny_text->text_right( $text ) ;

} #----------------------------------------------------------------------------------------------------

sub pdf_tiny_bold_text_right {

my ($along, $up, $text) = @_ ; $tiny_bold_text->translate( $along/mm, $up/mm ) ; $tiny_bold_text->text_right( $text ) ;

} #----------------------------------------------------------------------------------------------------

sub pdf_small_white_text_bold {

my ($along, $up, $text) = @_ ;	$small_bold_text_white->translate( $along/mm, $up/mm ); $small_bold_text_white->text( $text );

} #-------------------------------------------------------------------------------

sub pdf_small_medium_white_text_bold {

my ($along, $up, $text) = @_ ;	$small_medium_bold_text_white->translate( $along/mm, $up/mm ); $small_medium_bold_text_white->text( $text );

} #-------------------------------------------------------------------------------

sub pdf_medium_white_text_bold {

my ($along, $up, $text) = @_ ;	$medium_bold_text_white->translate( $along/mm, $up/mm ); $medium_bold_text_white->text( $text );

} #-------------------------------------------------------------------------------

sub pdf_large_white_text_bold {	

my ($along, $up, $text) = @_ ; $large_bold_text_white->translate( $along/mm, $up/mm ); $large_bold_text_white->text( $text );

} #-------------------------------------------------------------------------------

sub pdf_grey_text_above_right {

my ($along, $up, $text) = @_ ; $grey_text_above_right->translate( $along/mm, $up/mm ); $grey_text_above_right->text_right( $text );

} #-------------------------------------------------------------------------------

sub pdf_small_white_text_bold_right {

my ($along, $up, $text) = @_ ; $small_bold_text_white->translate( $along/mm, $up/mm ); $small_bold_text_white->text_right( $text );

} #-------------------------------------------------------------------------------

sub pdf_small_medium_white_text_bold_right {

my ($along, $up, $text) = @_ ;	$small_medium_bold_text_white->translate( $along/mm, $up/mm ); $small_medium_bold_text_white->text_right( $text );

} #-------------------------------------------------------------------------------

sub pdf_medium_white_text_bold_right {

my ($along, $up, $text) = @_ ;	$medium_bold_text_white->translate( $along/mm, $up/mm ); $medium_bold_text_white->text_right( $text );

} #-------------------------------------------------------------------------------

sub pdf_large_white_text_bold_right {

my ($along, $up, $text) = @_ ; $large_bold_text_white->translate( $along/mm, $up/mm ); $large_bold_text_white->text_right( $text );

} #-------------------------------------------------------------------------------

sub pdf_small_oblique_text {

my ($along, $up, $text) = @_ ; $small_oblique_text->translate( $along/mm, $up/mm ); $small_oblique_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_medium_oblique_text {

my ($along, $up, $text) = @_ ; $medium_oblique_text->translate( $along/mm, $up/mm ); $medium_oblique_text->text( $text );

} #----------------------------------------------------------------------------------------------------

sub pdf_medium_green_text {

my ($along, $up, $text) = @_ ; $medium_green_text->translate( $along/mm, $up/mm ); $medium_green_text->text( $text );

} #----------------------------------------------------------------------------------------------------

# sub pdf_get_text_width {
	
	# my ($$string) = @_ ;
	# my $text = $page->text;
	# my $font = $pdf->corefont('Helvetica');   # built-in font
	# my $size = 8;
	# $text->font($font, $size);
	# my $width = $text->advancewidth($string);	
	
# } #----------------------------------------------------------------------------------------------------

# sub pdf_get_text_width {
	
	# my ($string) = @_ ;
	# my $width = $text->advancewidth($string);	
	# return ($width) ;
	
# } #----------------------------------------------------------------------------------------------------

1;