apr

multiprint.php

apr
Jun 5th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.46 KB | None | 0 0
  1. <?php
  2.  
  3. include('function.php');
  4. if(!user_loggin_in()){die('You can not access this');}
  5.  
  6. if(!isset($_POST['check_list'])){die('no check');}
  7.  
  8. if(empty($_POST['check_list'])) {
  9.     die('You do not select any item');
  10. /*
  11.     foreach($_POST['check_list'] as $check) {
  12.             echo $check.'<br>'; //echoes the value set in the HTML form for each checked checkbox.
  13.                          //so, if I were to check 1, 3, and 5 it would echo value 1, value 3, value 5.
  14.                          //in your case, it would echo whatever $row['Report ID'] is equivalent to.
  15.     }
  16.     */
  17. }
  18.  
  19.  
  20.    
  21.  
  22.  
  23.                
  24.          
  25.                 require('fpdf.php');/////////////// use fpdf framework... ;)
  26.                 require('Barcode39.php');/////////////// use fpdf framework... ;)
  27.                
  28. class PDF extends FPDF {
  29.  
  30. const DPI = 96;
  31. const MM_IN_INCH = 25.4;
  32. const A4_HEIGHT = 150;
  33. const A4_WIDTH = 100;
  34. // tweak these values (in pixels)
  35. const MAX_WIDTH = 150;
  36. const MAX_HEIGHT = 100;
  37.  
  38. function pixelsToMM($val) {
  39. return $val * self::MM_IN_INCH / self::DPI;
  40. }
  41.  
  42. function resizeToFit($imgFilename) {
  43. list($width, $height) = getimagesize($imgFilename);
  44.  
  45. $widthScale = self::MAX_WIDTH / $width;
  46. $heightScale = self::MAX_HEIGHT / $height;
  47.  
  48. $scale = min($widthScale, $heightScale);
  49.  
  50. return array(
  51. round($this->pixelsToMM($scale * $width)),
  52. round($this->pixelsToMM($scale * $height))
  53. );
  54. }
  55.  
  56. function centreImage($img) {
  57. list($width, $height) = $this->resizeToFit($img);
  58.  
  59. // you will probably want to swap the width/height
  60. // around depending on the page's orientation
  61. $this->Image(
  62. $img, (self::A4_HEIGHT - $width) / 2,
  63. (self::A4_WIDTH - $height) / 2,
  64. $width,
  65. $height
  66. );
  67. }
  68. }
  69.  
  70. // usage:
  71.  
  72.  
  73.  
  74.  
  75.        
  76.              //    $pdf = new FPDF();
  77.                  $pdf = new PDF('P','mm',array(100,150));
  78.                  
  79.                  $pdf->SetMargins(0, 0, 0);
  80.                  $pdf->SetFont('calibri','B',3);
  81.  
  82.                  $pdf->AddPage();
  83.                //  $pdf->SetFont('calibri','',6);
  84.                  
  85.              //   $pdf->Cell(40,10,$data1);
  86.              
  87.             foreach($_POST['check_list'] as $check) {
  88.            
  89.              $pdf->SetMargins(0, 0, 0);
  90.              
  91.             $id = $check;
  92.             $query =mysql_query("SELECT * FROM user_content WHERE id='$id'");
  93.             $count = mysql_num_rows($query);
  94.             if($count==0){die();}
  95.             $row = mysql_fetch_array($query);
  96.             /*
  97.                        
  98.             $current_user = user_info('id');     
  99.                    $data2 = ' Customer : '. $row ['info1'];
  100.                    $data2 = ' Contract : '. $row ['info2'];
  101.                 $data3 = ' Job : '. $row ['info3'];
  102.                 $data4 = ' Model : '. $row ['info4'] ;
  103.                 $data5 = ' Quantity : '. $row ['info5'] ;
  104.                 $data6 = ' date : '. $row ['info6 '] ;
  105.            
  106.             */
  107.            
  108.         $bc = new Barcode39($row ['info5']);
  109.  
  110. // set text size
  111. $bc->barcode_text_size = 5;
  112.  
  113. // set barcode bar thickness (thick bars)
  114. $bc->barcode_bar_thick = 4;
  115.  
  116. // set barcode bar thickness (thin bars)
  117. $bc->barcode_bar_thin = 2;
  118.  
  119. // save barcode GIF file
  120. $bc->draw("barcode.gif");
  121.  
  122.        
  123.            
  124.             $demo1= ' PowerStar Inc';
  125.             $demo2= ' Cage Code: 0ZAP8';
  126.             $demo3= ' (800) 209-5556';
  127.             $info5s = ' Model : '.$row ['info4'];
  128.             $info6s = ' Serial : '.$row ['info5'];
  129.             $current_user = user_info('id');     
  130.            
  131.            
  132.                 $pdf->Ln();
  133.                 $pdf->Ln();
  134.                 $pdf->Ln();
  135.                 $pdf->Ln();
  136.                 $pdf->Cell(40,10,$demo1);
  137.                 $pdf->Ln();
  138.                 $pdf->Cell(40,10,$demo2);
  139.                 $pdf->Ln();
  140.                 $pdf->Cell(40,10,$demo3);
  141.                 $pdf->Ln();
  142.                 $pdf->Cell(40,10,$info5s);
  143.                 $pdf->Ln();
  144.                 $pdf->Cell(40,10,$info6s);
  145.                 $pdf->Ln();
  146.                 $pdf->Ln();
  147.                 //pdf  barocde
  148.                 $image1 = 'barcode.gif' ;
  149.                 //$pdf->Cell( 200, 200, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 33.78), 0, 0, 'L', false );
  150.                 //$pdf->Cell(7, 5,$pdf->Image($image1));
  151.                 //$pdf->Image($image1, (100) / 2,(100) / 2,50,50);
  152.                 //$pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 80,50);
  153.                 $pdf->Image($image1, 10, $pdf->GetY(), 80,50);
  154.                 //$pdf->centreImage($image1);
  155.                 $pdf->Ln();
  156.                 $pdf->Ln();
  157.                 $pdf->Ln();
  158.                 $pdf->Ln();
  159.                 $pdf->Ln();
  160.                 $pdf->Ln();
  161.                 $pdf->Ln();
  162.                 $pdf->Ln();
  163.                 $pdf->Ln();
  164.                 $pdf->Ln();
  165.                 $pdf->Ln();
  166.                 $pdf->Ln();
  167.                 $pdf->Ln();
  168.                 $pdf->Ln();
  169.                 $pdf->Ln();
  170.                 $pdf->Ln();
  171.                 $pdf->Ln();
  172.                 $pdf->Ln();
  173.                 $pdf->Ln();
  174.                 $pdf->Ln();
  175.                 $pdf->Ln();
  176.                 $pdf->Ln();
  177.                 $pdf->Ln();
  178.                 $pdf->Ln();
  179.                 $pdf->Ln();
  180.                 $pdf->Ln();
  181.                 $pdf->Ln();
  182.                 $pdf->Ln();
  183.                 $pdf->Ln();
  184.                 $pdf->Ln();
  185.                 $pdf->Ln();
  186.                 $pdf->Ln();
  187.                 $pdf->Ln();
  188.                 $pdf->Ln();
  189.                 $pdf->Ln();
  190.                 $pdf->Ln();
  191.                 $pdf->Ln();
  192.                 $pdf->Ln();
  193.                 $pdf->Ln();
  194.                 $pdf->Ln();
  195.                 $pdf->Ln();
  196.                 $pdf->Ln();
  197.                 $pdf->Ln();
  198.                 $pdf->Ln();
  199.                 $pdf->Ln();
  200.                 $pdf->Ln();
  201.                 $pdf->Ln();
  202.                 $pdf->Ln();
  203.                 $pdf->Ln();
  204.                 $pdf->Ln();
  205.                 $pdf->Ln();
  206.                 $pdf->Ln();
  207.                 $pdf->Ln();
  208.                 $pdf->Ln();
  209.                 $pdf->Ln();
  210.                 $pdf->Ln();
  211.                 $pdf->Ln();
  212.                 $pdf->Ln();
  213.                 $pdf->Ln();
  214.                 $pdf->Ln();
  215.                 $pdf->Ln();
  216.                 $pdf->Ln();
  217.                 $pdf->Ln();
  218.                 $pdf->Ln();
  219.                 $pdf->Ln();
  220.                 $pdf->Ln();
  221.                 $pdf->Ln();
  222.                 $pdf->Ln();
  223.                 $pdf->Ln();
  224.                 $pdf->Ln();
  225.                 $pdf->Ln();
  226.                 $pdf->Ln();
  227.                 $pdf->Ln();
  228.                 $pdf->Ln();
  229.                 $pdf->Ln();
  230.                 $pdf->Ln();
  231.                 $pdf->Ln();
  232.                 $pdf->Ln();
  233.                 $pdf->Ln();
  234.                 $pdf->Ln();
  235.                 $pdf->Ln();
  236.                
  237.                
  238.                
  239.                 //$pdf->Cell(40,10,'new deteil');
  240.              
  241.                          
  242.                 }
  243.                  
  244.                  
  245.                  
  246.                  
  247.                  
  248.                  
  249.                  
  250.                  $pdf->Output( "report.pdf", "I" );
Advertisement
Add Comment
Please, Sign In to add comment