Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('function.php');
- if(!user_loggin_in()){die('You can not access this');}
- if(!isset($_POST['check_list'])){die('no check');}
- if(empty($_POST['check_list'])) {
- die('You do not select any item');
- /*
- foreach($_POST['check_list'] as $check) {
- echo $check.'<br>'; //echoes the value set in the HTML form for each checked checkbox.
- //so, if I were to check 1, 3, and 5 it would echo value 1, value 3, value 5.
- //in your case, it would echo whatever $row['Report ID'] is equivalent to.
- }
- */
- }
- require('fpdf.php');/////////////// use fpdf framework... ;)
- require('Barcode39.php');/////////////// use fpdf framework... ;)
- class PDF extends FPDF {
- const DPI = 96;
- const MM_IN_INCH = 25.4;
- const A4_HEIGHT = 150;
- const A4_WIDTH = 100;
- // tweak these values (in pixels)
- const MAX_WIDTH = 150;
- const MAX_HEIGHT = 100;
- function pixelsToMM($val) {
- return $val * self::MM_IN_INCH / self::DPI;
- }
- function resizeToFit($imgFilename) {
- list($width, $height) = getimagesize($imgFilename);
- $widthScale = self::MAX_WIDTH / $width;
- $heightScale = self::MAX_HEIGHT / $height;
- $scale = min($widthScale, $heightScale);
- return array(
- round($this->pixelsToMM($scale * $width)),
- round($this->pixelsToMM($scale * $height))
- );
- }
- function centreImage($img) {
- list($width, $height) = $this->resizeToFit($img);
- // you will probably want to swap the width/height
- // around depending on the page's orientation
- $this->Image(
- $img, (self::A4_HEIGHT - $width) / 2,
- (self::A4_WIDTH - $height) / 2,
- $width,
- $height
- );
- }
- }
- // usage:
- // $pdf = new FPDF();
- $pdf = new PDF('L','mm',array(25,75),0,0,0,0,0,0,0,0);
- // $pdf->SetFont('Times','',0.05); // 12 px = 3.175mm , 16 = 4.233333
- //http://www.endmemo.com/sconvert/millimeterpixel.php
- $pdf->SetMargins(0, 0, 0);
- $pdf->SetFont('calibri','',1);
- // $pdf->SetFont('calibri','',6);
- // $pdf->Cell(40,10,$data1);
- foreach($_POST['check_list'] as $check) {
- // $pdf->SetMargins(0, 0, 0);
- $pdf->AddPage();
- $id = $check;
- $query =mysql_query("SELECT * FROM user_content WHERE id='$id'");
- $count = mysql_num_rows($query);
- if($count==0){die();}
- $row = mysql_fetch_array($query);
- /*
- $current_user = user_info('id');
- $data2 = ' Customer : '. $row ['info1'];
- $data2 = ' Contract : '. $row ['info2'];
- $data3 = ' Job : '. $row ['info3'];
- $data4 = ' Model : '. $row ['info4'] ;
- $data5 = ' Quantity : '. $row ['info5'] ;
- $data6 = ' date : '. $row ['info6 '] ;
- */
- $bc = new Barcode39($row ['info5'],false);
- // set text size
- //$bc->barcode_text_size = 5;
- // set barcode bar thickness (thick bars)
- $bc->barcode_bar_thick = 4;
- // set barcode bar thickness (thin bars)
- $bc->barcode_bar_thin = 2;
- // save barcode GIF file
- $bc->draw("barcode.gif");
- $demo1= ' PowerStar Inc';
- $demo2= ' Cage Code: 0ZAP8';
- $demo3= ' (800) 209-5556';
- $info5s = ' Model : '.$row ['info4'];
- $info6s = ' Serial : '.$row ['info5'];
- $current_user = user_info('id');
- ; $pdf->SetX(5);
- // $pdf->SetLeftMargin(30);
- $pdf->Write(5,'this text is crooked');
- $pdf->Write(5,'this text is crooked');
- //$pdf->Cell(10,10,$demo1);
- //$pdf->Ln(1);
- $pdf->Cell(5,5,$demo2);
- $pdf->Ln(0);
- $pdf->Cell(5,5,$demo3);
- $pdf->Ln(0);
- $pdf->Cell(10,5,$info5s);
- $pdf->Ln(0);
- $pdf->Cell(10,5,$info6s);
- $pdf->Ln();
- $pdf->Ln();
- //pdf barocde
- $image1 = 'barcode.gif' ;
- //$pdf->Cell( 200, 200, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 33.78), 0, 0, 'L', false );
- //$pdf->Cell(7, 5,$pdf->Image($image1));
- //$pdf->Image($image1, (100) / 2,(100) / 2,50,50);
- //$pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 80,50);
- //$pdf->Image($image1, 5, $pdf->GetY(), 30,20);
- //$pdf->Image($image1,4, $pdf->GetY()-13, 22,8);
- $pdf->Ln(5);
- $pdf->Image($image1,35, $pdf->GetY()-13, 40,8);
- //$pdf->centreImage($image1);
- // $pdf->Cell(0,10,$demo2,0,0,'C');
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- $pdf->Ln();
- //$pdf->Cell(40,10,'new deteil');
- }
- $pdf->Output( "report.pdf", "I" );
Advertisement
Add Comment
Please, Sign In to add comment