[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/barcodes barcodes.pl label-print-opus-pdf.pl [rel_3_0]
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/barcodes barcodes.pl label-print-opus-pdf.pl [rel_3_0] |
Date: |
Tue, 09 Jan 2007 10:08:17 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 07/01/09 10:08:17
Modified files:
barcodes : barcodes.pl label-print-opus-pdf.pl
Log message:
sync with dev_week.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/barcodes.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.4&r2=1.5.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-print-opus-pdf.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.3&r2=1.2.2.4
Patches:
Index: barcodes.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/barcodes.pl,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -b -r1.5.2.4 -r1.5.2.5
--- barcodes.pl 22 Dec 2006 15:02:56 -0000 1.5.2.4
+++ barcodes.pl 9 Jan 2007 10:08:17 -0000 1.5.2.5
@@ -25,8 +25,6 @@
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
-
-
use C4::Context;
use C4::Barcodes::PrinterConfig;
@@ -65,7 +63,6 @@
my %keyValues = %{ shift @_ };
my $i;
open FILE, ">$fileName";
- my $i;
foreach $i ( keys(%keyValues) ) {
print FILE $i . " = " . $keyValues{$i} . "\n";
}
@@ -116,7 +113,7 @@
# Takes the country codes from a file and use them to set the country list.
my $countryCodes =
&getPath("intranet") . "/includes/countryCodes/countryCodes.dat";
-my %list = &loadConfFromFile($countryCodes);
+%list = &loadConfFromFile($countryCodes);
@listValues = keys(%list);
my $number_system = CGI::scrolling_list(
-name => 'numbersystem',
Index: label-print-opus-pdf.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-print-opus-pdf.pl,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -b -r1.2.2.3 -r1.2.2.4
--- label-print-opus-pdf.pl 18 Dec 2006 17:44:06 -0000 1.2.2.3
+++ label-print-opus-pdf.pl 9 Jan 2007 10:08:17 -0000 1.2.2.4
@@ -19,50 +19,172 @@
use CGI;
use C4::Labels;
use C4::Auth;
-use C4::Serials;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Context;
use PDF::Reuse;
use PDF::Reuse::Barcode;
-use PDF::Report;
-use PDF::Create;
-use PDF::Labels;
-use Acme::Comment;
+use POSIX;
+use Text::Wrap;
-my $htdocs_path = C4::Context->config('intrahtdocs');
-my $cgi = new CGI;
-my $pdf = new PDF::Labels(
- $PDF::Labels::PageFormats[1],
- filename => "$htdocs_path/barcodes/opus.pdf",
- Author => 'PDF Labelmaker',
- 'PageMode' => 'UseOutlines',
- Title => 'My Labels'
-);
+$Text::Wrap::columns = 39;
+$Text::Wrap::separator = "\n";
-warn "$htdocs_path/barcodes/opus.pdf";
+my $htdocs_path = C4::Context->config('intrahtdocs');
+my $cgi = new CGI;
+my $spine_text = "";
+# get the printing settings
+my $conf_data = get_label_options();
my @resultsloop = get_label_items();
-
-$pdf->setlabel(0); # Start with label 5 on first page
-
-foreach my $result (@resultsloop) {
- warn Dumper $result;
- $pdf->label( $result->{'itemtype'}, $result->{'number'}, 'LAK',
- $result->{'barcode'} );
- $pdf->label( $result->{'itemtype'}, $result->{'dewey'}, 'LAK',
- $result->{'barcode'} );
-
+my $barcodetype = $conf_data->{'barcodetype'};
+my $printingtype = $conf_data->{'printingtype'};
+my $guidebox = $conf_data->{'guidebox'};
+my $startrow = $conf_data->{'startrow'};
+
+# if none selected, then choose 'both'
+if ( !$printingtype ) {
+ $printingtype = 'both';
}
-$pdf->close();
-#--------------------------------------------------
+# opus paper dims. in *millimeters*
+# multiply values by '2.83465', to find their value in Postscript points.
-use PDF::Reuse;
-prFile("$htdocs_path/barcodes/opus1.pdf");
-prDoc("$htdocs_path/barcodes/opus.pdf");
+# $xmargin = 12;
+# $label_height = 34;
+# $label_width = 74;
+# $x_pos_spine = 12;
+# $pageheight = 304;
+# $pagewidth = 174;
+# $line_spacer = 10;
+# $label_rows = 8;
+
+# sheet dimensions in PS points.
+
+my $top_margin = 7;
+my $left_margin = 34;
+my $top_text_margin = 20;
+my $left_text_margin = 10;
+my $label_height = 96;
+my $spine_width = 210;
+my $colspace = 9;
+my $rowspace = 11;
+my $x_pos_spine = 36;
+my $pageheight = 861;
+my $pagewidth = 493;
+my $line_spacer = 10;
+my $label_rows = 8;
+
+# setting up the pdf doc
+#remove the file before write, for testing
+#unlink "$htdocs_path/barcodes/new.pdf";
+#prFile("$htdocs_path/barcodes/new.pdf");
+#prLogDir("$htdocs_path/barcodes");
+
+# fix, no longer writes to temp dir
+prInitVars(); # To initiate ALL global variables and tables
+$| = 1;
+print STDOUT "Content-Type: application/pdf \n\n";
+prFile();
+
+prMbox( 0, 0, $pagewidth, $pageheight );
+prFont('courier'); # Just setting a font
+prFontSize(9);
+
+my $str;
+
+my $y_pos_initial = ( ( $pageheight - $top_margin ) - $label_height );
+my $y_pos_initial_startrow =
+ ( ( $pageheight - $top_margin ) - ( $label_height * $startrow ) );
+my $y_pos = $y_pos_initial_startrow;
+
+my $page_break_count = $startrow;
+my $codetype = 'Code39';
+
+#do page border
+# commented out coz it was running into the side-feeds of the paper.
+# drawbox( 0, 0 , $pagewidth, $pageheight );
+
+my $item;
+
+# for loop
+my $i2 = 1;
+
+foreach $item (@resultsloop) {
+ my $x_pos_spine_tmp = $x_pos_spine;
+
+ for ( 1 .. 2 ) {
+
+ if ( $guidebox == 1 ) {
+ warn
+"COUNT1, PBREAKCNT=$page_break_count, y=$y_pos, labhght = $label_height";
+ drawbox( $x_pos_spine_tmp, $y_pos, $spine_width, $label_height );
+ }
+
+ #-----------------draw spine text
+ if ( $printingtype eq 'spine' || $printingtype eq 'both' ) {
+
+ #warn "PRINTTYPE = $printingtype";
+
+ # add your printable fields manually in here
+ my @fields = qw (itemtype dewey isbn classification);
+ my $vPos = ( $y_pos + ( $label_height - $top_text_margin ) );
+ my $hPos = ( $x_pos_spine_tmp + $left_text_margin );
+ foreach my $field (@fields) {
+
+ # if the display option for this field is selected in the DB,
+ # and the item record has some values for this field, display
it.
+ if ( $conf_data->{"$field"} && $item->{"$field"} ) {
+
+ #warn "CONF_TYPE = $field";
+
+ # get the string
+ $str = $item->{"$field"};
+
+ # strip out naughty existing nl/cr's
+ $str =~ s/\n//g;
+ $str =~ s/\r//g;
+
+ # chop the string up into _upto_ 12 chunks
+ # and seperate the chunks with newlines
+
+ $str = wrap( "", "", "$str" );
+ $str = wrap( "", "", "$str" );
+
+ # split the chunks between newline's, into an array
+ my @strings = split /\n/, $str;
+
+ # then loop for each string line
+ foreach my $str (@strings) {
+
+ warn "HPOS , VPOS $hPos, $vPos ";
+ prText( $hPos, $vPos, $str );
+ $vPos = $vPos - $line_spacer;
+ }
+ } # if field is valid
+ } # foreach @field
+ } #if spine
+
+ $x_pos_spine_tmp = ( $x_pos_spine_tmp + $spine_width + $colspace );
+ } # for 1 ..2
+ warn " $y_pos - $label_height - $rowspace";
+ $y_pos = ( $y_pos - $label_height - $rowspace );
+ warn " $y_pos - $label_height - $rowspace";
+
+ #-----------------draw spine text
+
+ # the gaylord labels have 8 rows per sheet, this pagebreaks after 8 rows
+ if ( $page_break_count == $label_rows ) {
+ prPage();
+ $page_break_count = 0;
+ $i2 = 0;
+ $y_pos = $y_pos_initial;
+ }
+ $page_break_count++;
+ $i2++;
+}
prEnd();
-print $cgi->redirect("/intranet-tmpl/barcodes/opus1.pdf");
+#print $cgi->redirect("/intranet-tmpl/barcodes/new.pdf");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/barcodes barcodes.pl label-print-opus-pdf.pl [rel_3_0],
Antoine Farnault <=