@@ -, +, @@ design --- C4/Patroncards/Patroncard.pm | 57 ++++++++++++++++++++++ .../prog/en/modules/patroncards/edit-layout.tt | 10 ++++ patroncards/create-pdf.pl | 1 + patroncards/edit-layout.pl | 2 + 4 files changed, 70 insertions(+) --- a/C4/Patroncards/Patroncard.pm +++ a/C4/Patroncards/Patroncard.pm @@ -69,6 +69,7 @@ sub draw_barcode { sub draw_guide_box { my ($self, $pdf) = @_; warn sprintf('No pdf object passed in.') and return -1 if !$pdf; + my $obj_stream = "q\n"; # save the graphic state $obj_stream .= "0.5 w\n"; # border line width $obj_stream .= "1.0 0.0 0.0 RG\n"; # border color red @@ -79,6 +80,62 @@ sub draw_guide_box { $pdf->Add($obj_stream); } +sub draw_guide_grid { + my ($self, $pdf) = @_; + warn sprintf('No pdf object passed in.') and return -1 if !$pdf; + + my $obj_stream = "q\n"; # save the graphic state + + my $x = $self->{'llx'}; + my $y = $self->{'lly'}; + + my $cnt = 0; + for ( $x = $self->{'llx'} ; $x <= $self->{'llx'} + $self->{'width'}; $x+=10) { + my $xx = $x; + my $yy = $y + $self->{'height'}; + if ( $cnt % 5 ) { + $obj_stream .= "0.0 1.0 1.0 RG\n"; + $obj_stream .= "0 w\n"; + } else { + $obj_stream .= "0.0 0.0 1.0 RG\n"; + $obj_stream .= "0 w\n"; + } + $cnt ++; + + $obj_stream .= "$x $y m\n"; + $obj_stream .= "$xx $yy l\n"; + + $obj_stream .= "s\n"; + } + + $x = $self->{'llx'}; + $y = $self->{'lly'}; + $cnt = 0; + for ( $y = $self->{'lly'}; $y <= $self->{'lly'} + $self->{'height'}; $y+=10) { + + my $xx = $x + $self->{'width'}; + my $yy = $y; + + if ( $cnt % 5 ) { + $obj_stream .= "0.0 1.0 1.0 RG\n"; + $obj_stream .= "0 w\n"; + } else { + $obj_stream .= "0.0 0.0 1.0 RG\n"; + $obj_stream .= "0 w\n"; + } + $cnt ++; + + $obj_stream .= "$x $y m\n"; + $obj_stream .= "$xx $yy l\n"; + $obj_stream .= "s\n"; + } + + $obj_stream .= "Q\n"; # restore the graphic state + + $pdf->Add($obj_stream); +} + + sub draw_text { my ($self, $pdf, %params) = @_; warn sprintf('No pdf object passed in.') and return -1 if !$pdf; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt @@ -176,6 +176,16 @@ Off [% END %] +