} } class MYPDF_BARCODE extends TCPDF { public function Header() { } // Page footer public function Footer() { } } login_varify(); // for barcode $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => '0', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 10, 'stretchtext' => 4); $pdf = new MYPDF_BARCODE('', 'mm', array("50", "25"), true, 'UTF-8', false); $pdf->SetMargins(0, 0, $right = -1, $keepmargins = true); $pdf->setPrintFooter(false); $pdf->setPrintHeader(false); $pdf->SetAutoPageBreak(TRUE, 0); $pdf->setCellPaddings(0, 0, 0, 0); //minimum 2 mm margin //25-4=21 available Y //50-5=46 available X //5 line 1, 10 barcode, 5 line 3 $sample_id_list = explode("|", $_POST['list_of_samples']); //print_r($sample_id_list); foreach ($sample_id_list as $key => $value) { if (strlen($value) > 0) { print_duplicate_lable($pdf, $style, $value); }
echo '<form method=post target=_blank><table> <th colspan=2>Print 48 Lables in 4x12 array on A4 page</th> <tr><td>Text of first line</td><td><input type=text name=line1></td></tr> <tr><td>Text of second line</td><td><input type=text name=line2></td></tr> <tr><td>Text of third line</td><td><input type=text name=line3></td></tr> <tr><td><input type=submit name=submit value=print></td></tr> </table></form>'; } else { // for barcode $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => '0', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 6, 'stretchtext' => 4); //Page header W=210 H=148 //210 × 297 A4 //180,x270 (30,27) //3 x 9 //$this->SetXY(18,$y_counter); $pdf = new MYPDF_BARCODE('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->AddPage(); $pdf->SetMargins(0, 0, $right = -1, $keepmargins = true); $pdf->setPrintFooter(false); $pdf->setPrintHeader(false); $pdf->SetAutoPageBreak(TRUE, 0); $pdf->setCellPaddings(0, 0, 0, 0); /* * planning * 210 × 297 A4 * 4 columns, 12 raws, 5 mm margin so lable width=50 * 12 raws, 10 mm margin, so 23 mm height * */ $um = 5; //upper margin $lm = 5;
} } class MYPDF_BARCODE extends TCPDF { public function Header() { } // Page footer public function Footer() { } } login_varify(); // for barcode $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => '0', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 10, 'stretchtext' => 4); $pdf = new MYPDF_BARCODE('', 'mm', array("50", "25"), true, 'UTF-8', false); $pdf->SetMargins(0, 0, $right = -1, $keepmargins = true); $pdf->setPrintFooter(false); $pdf->setPrintHeader(false); $pdf->SetAutoPageBreak(TRUE, 0); $pdf->setCellPaddings(0, 0, 0, 0); //minimum 2 mm margin //25-4=21 available Y //50-5=46 available X //5 line 1, 10 barcode, 5 line 3 function general_form() { echo '<form method=post target=_blank><table border=1> <tr><th colspan=10 style="background-color:lightpink;">50mmx25mm barcode lables</th></tr> <tr><th colspan=10 style="background-color:lightblue;">Print multiple copies of lables with 4 lines</th></tr> <tr><td>line1</td><td><input type=text name=line1></td></tr>