Advertisement
Kaidul

php-to-pdf

Dec 25th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.41 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if (!$_SESSION["applicant"])
  4. {
  5. Header("Location:../login.php");
  6. }
  7. require('fpdf.php');
  8. include ("../dbConfig.php");
  9. $app=$_SESSION["applicant"];
  10. $all="SELECT name, roll_number, photo_name, status FROM candidate WHERE application_number= '$app'";
  11.   $result = mysql_query($all);
  12.  while($rows=mysql_fetch_array($result))
  13.  {
  14.   $name=$rows['name'];
  15.   $roll_number= $rows['roll_number'];
  16.   $status= $rows['status'];
  17.   $photo= $rows['photo_name'];
  18.  }
  19. class PDF extends FPDF
  20. {
  21. function Header()
  22. {
  23.     $this->Image('../images/kuet_icon.png',6,6,0);
  24.     $this->SetFont('Arial','B',20);
  25.     $this->Cell(80);
  26.     $this->Cell(45,10,"Khulna University of Engineering & Technology",0,0,'C');
  27.     $this->Ln(10);
  28.     $this->Cell(80);
  29.     $this->Cell(45,10,"Admit Card",0,0,'C');
  30.     $this->Ln(20);
  31. }
  32. function Footer()
  33. {
  34.     $this->SetY(-15);
  35.     $this->SetFont('Arial','I',8);
  36.     $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  37. }
  38. }
  39. $pdf = new PDF();
  40. $pdf->AliasNbPages();
  41. $pdf->AddPage();
  42. //////
  43. $pdf->SetFont( 'Arial', '', 10 );
  44. $pdf->SetDrawColor( 00, 00, 00 );
  45. $pdf->SetTextColor(00,00,00 );
  46. $pdf->SetFillColor( 255,255,255 );
  47. $image1 = "../uploads/".$photo;
  48. $pdf->Cell( 43, 9,"Candidate's name", 1, 0, 'C', true );
  49. $pdf->Cell( 33, 9,$name, 1, 0, 'C', true );
  50. $pdf->Cell( 48, 56, $pdf->Image($image1, $pdf->GetX()+50, $pdf->GetY()-10,48, 56), 0, 0, 'L', false );
  51. $pdf->Ln( 9);
  52. $pdf->Cell( 43, 9,'Application number', 1, 0, 'C', true );
  53. $pdf->SetFont( 'Arial', 'B', 12 );
  54. $pdf->Cell( 33, 9,$_SESSION["applicant"], 1, 0, 'C', true );
  55. $pdf->Ln( 9);
  56. $pdf->SetFont( 'Arial', '', 10 );
  57. $pdf->Cell( 43,10,'Admission Roll number', 1, 0, 'C', true );
  58. $pdf->SetFont( 'Arial', 'B', 12 );
  59. $pdf->Cell( 33,10,$roll_number, 1, 0, 'C', true );
  60. $pdf->Ln(30);
  61. if($status == "9"){
  62. $pdf->SetFont('Arial','B',60);
  63. $pdf->Cell(0,15,"P   ",0,1,'R');
  64. }
  65. if($status == "10"){
  66. $pdf->SetFont('Arial','B',60);
  67. $pdf->Cell(0,15,"T   ",0,1,'R');
  68. }
  69. $pdf->SetFont( 'Arial', '', 10 );
  70. $pdf->Cell(0,15,"N.B: You must have to bring your admit card in the examination hall otherwise you're not allowed to seat for examination",0,1,'C');
  71. $pdf->Image('signature.jpg',140,110);
  72. $pdf->SetFont('Times','',12);
  73. $pdf->Ln(20);
  74. $pdf->Cell(0,8,"Vice Chancellor                     ",0,1,'R');
  75. $pdf->Cell(0,8,"Khulna University of Engineering & Technology ",0,1,'R');
  76. $pdf->Cell(0,8,"Khulna, Bangladesh.               ",0,1,'R');
  77. $pdf->Output();
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement