-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_4_line_label.php
120 lines (102 loc) · 2.23 KB
/
print_4_line_label.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
$GLOBALS['nojunk']='';
require_once 'project_common.php';
require_once 'base/verify_login.php';
////////User code below/////////////////////
//echo '<pre>';print_r($_POST);echo '</pre>';
//exit();
/*
Array
(
[line1] => rew89
[line2] => rew7
[range] => line2
[line3] => rew6
[line4] => dfg
[from] => 1
[to] => 5
[action] => view_dbid
[session_name] => sn_1692785306
)
*/
$pdf=get_pdf_link_for_barcode();
if(is_numeric($_POST['from']) && is_numeric($_POST['to']))
{
$from=$_POST['from'];
$to=$_POST['to'];
}
else
{
$from=false;
$to=false;
}
prepare_label($pdf,$from,$to);
print_pdf($pdf,'barcode.pdf');
function prepare_label($pdf,$from,$to)
{
$style = array(
'position' => '',
'align' => 'C',
'stretch' => true,
'cellfitalign' => '',
'border' => false,
'hpadding' => 'auto',
'vpadding' => '0',
'fgcolor' => array(0,0,0),
'bgcolor' => false, //array(255,255,255),
'text' => true,
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4
);
if($from!=False && $to!=false && isset($_POST['range']))
{
for($counter=$from;$counter<=$to;$counter++)
{
$pdf->AddPage();
$pdf->SetFont('helveticaB', '', 9);
for($i=0;$i<4;$i++)
{
if($_POST['range']=='line'.($i+1))
{
$text=$_POST['line'.($i+1)].'^'.$counter;
}
else
{
$text=$_POST['line'.($i+1)];
}
$pdf->SetXY(5,($i+1)*4);
if(isset($_POST['barcode'.($i+1)]))
{
$pdf->write1DBarcode($text, 'C128',5,($i+1)*4 , 40, 9, 0.4, $style, 'N');
$i++;
}
else
{
$pdf->Cell (40,4,$text,$border=0, $ln=1, $align='', $fill=false,
$link='', $stretch=1, $ignore_min_height=false, $calign='T', $valign='M');
}
}
}
}
else
{
$pdf->AddPage();
$pdf->SetFont('helveticaB', '', 9);
for($i=0;$i<4;$i++)
{
$pdf->SetXY(5,($i+1)*4);
if(isset($_POST['barcode'.($i+1)]))
{
$pdf->write1DBarcode($_POST['line'.($i+1)], 'C128',5,($i+1)*4 , 40, 10, 0.4, $style, 'N');
$i++;
}
else
{
$pdf->Cell (40,4,$_POST['line'.($i+1)],$border=0, $ln=1, $align='', $fill=false,
$link='', $stretch=1, $ignore_min_height=false, $calign='T', $valign='M');
}
}
}
}
?>