2014-07-14 1 views
1

데이터베이스에서 데이터를 검색하고 FPDF를 사용하여 PDF로 표시합니다. PHP에서 fpdf를 사용하는 경계없는 테이블

다음

내가 달성하기 위해 노력하고 무엇 : enter image description here

이것은 내가 지금까지 한 일이다 : 그것은 완전히 잘못 표시

$pdf->Write(10,"Qualification(1):$text ".$record['Qualification']); 
$pdf->Ln(); //Go to a new line 
$pdf->Write(10,"Awarding body/Institution:$text1".$record['IssuingBody']); 
$pdf->Ln(); 
$pdf->Write(10,"Date of completion/award:$text2".$record['CompletionDate']); 
$pdf->Ln(); 
$pdf->Write(10,"Purpose of the qualification:$text2".$record['CountryEligibility']); 
$pdf->Ln(); 
$pdf->Write(10,"Minimum duration of study:$text2".$record['EntryRequirements']); 

, 따라서 나는 경계선 테이블에 표시 고려하고있다. FPDF로 처음으로 작업 한 경우

+0

css/html로 PDF 내용을 스타일링 해 보셨습니까? – HddnTHA

+1

FPDF의 [테이블 튜토리얼] (http://www.fpdf.org/en/tutorial/tuto5.htm)을보십시오. 기본적으로 테두리가없는 [셀] (http://www.fpdf.org/en/doc/cell.htm)이 필요합니다 (네 번째 매개 변수). – VMai

답변

1

셀 구문에서 영 (0)은 경계선을 나타내지 않습니다. 다중 셀에서도 동일하게 작동합니다.

<?php 

include_once 'scripts/init.php'; //Connect to the database 
require 'fpdf/fpdf.php'; 
require 'fpdf/rotation.php'; //import fpdf and the watermark class 

$aptid = $_SESSION['apt']; //The applicant ID 

//Class to create the water mark 
class PDF extends PDF_Rotate 
{ 
function Header() 
{ 
    //Put the watermark 
    $this->SetFont('Arial','B',50); 
    $this->SetTextColor(255,192,203); 
    $this->RotatedText(35,190,'FOR VERIFICATION ONLY',45); 
} 

function RotatedText($x, $y, $txt, $angle) 
{ 
    //Text rotated around its origin 
    $this->Rotate($angle,$x,$y); 
    $this->Text($x,$y,$txt); 
    $this->Rotate(0); 
} 
} 

$pdf=new PDF(); //create an instance of the fpdf class 
$pdf->AddPage(); //create the pdf page 

//Retrieve the qualification holder details from the database 
$query = "SELECT a.QhFullName, a.QhDOB, a.Qualification, a.IssuingBody, a.CompletionDate, a.EntryRequirements, a.CountryEligibility, a.ProgrammeRequirements, a.MinStudyDuration, a.CountryLevel, a.OrgField, a.SubFramework, a.NQFLevel, a.Credits, a.ClosestQualification 
        FROM Evaluation a 
        INNER JOIN Apn b ON a.ApnID = b.AptID 
        WHERE b.AptID LIKE $aptid"; 


    $stmt = sqlsrv_query($conn, $query); 

    $record = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); 
    $text = 'Born: '; 
    $text0 = '                  '; 
    $text1 = '          '; 

    //heading 
    $pdf->SetFont("Arial","B",10); 
    $pdf->Cell(0,10,$record['QhFullName'].$text0.$text.$record['QhDOB'],1,1,"L"); 
    //body of the pdf 
    $pdf->ln(); 



//Display the qualification holders details on a pdf table using Cells 
$pdf->SetFont("Arial","",06); 
$pdf->Cell(80,5,'Qualification(1):',0,0,'L',0); 
$pdf->Cell(80,5,$record['Qualification'],0,1,'L',0); 
$pdf->Cell(80,5,'Awarding body/Institution:',0,0,'L',0); 
$pdf->Cell(80,5,$record['IssuingBody'],0,1,'L',0); 
$pdf->Cell(80,5,'Date of completion/award:',0,0,'L',0); 
$pdf->Cell(80,5,$record['CompletionDate'],0,1,'L',0); 
$pdf->Cell(80,5,'Purpose of the qualification:',0,0,'L',0); 
$pdf->Cell(80,5,$record['CountryEligibility'],0,1,'L',0); 
$pdf->Cell(80,5,'Minimum entry requirement:',0,0,'L',0); 
$pdf->MultiCell(80, 5,$record['EntryRequirements'], 0); 
$pdf->Cell(80,5,'Minimum duration of study:',0,0,'L',0); 
$pdf->Cell(80,5,$record['MinStudyDuration'],0,1,'L',0); 
$pdf->Cell(80,5,'Requirements for the award:',0,0,'L',0); 
$pdf->Cell(80,5,$record['ProgrammeRequirements'],0,1,'L',0); 
$pdf->Cell(80,5,'Requirements for the award:',0,0,'L',0); 
$pdf->Cell(80,5,$record['CountryLevel'],0,1,'L',0); 

$pdf->SetFont("Arial","B",08); 
$pdf->Cell(80,9,'RECOGNITION DECISION',0,1,'L',0); 

$pdf->Cell(80,5,'Qualification(s) describe above:',0,0,'L',0); 
$pdf->Cell(80,5,'Closest comparable South African qualification/qualification type',0,1,'L',0); 

$pdf->Cell(80,5,'(1):',0,0,'C',0); 
$pdf->Cell(80,5,$record['ClosestQualification'],0,1,'L',0); 
$pdf->SetFont("Arial","",08); 
$pdf->Cell(80,5,'Organising Field:',0,0,'L',0); 
$pdf->SetFont("Arial","B",08); 
$pdf->Cell(80,5,$record['OrgField'],0,1,'L',0); 
$pdf->SetFont("Arial","",08); 
$pdf->Cell(80,5,'Sub-framework location:',0,0,'L',0); 
$pdf->SetFont("Arial","B",08); 
$pdf->Cell(80,5,$record['SubFramework'],0,1,'L',0); 

$pdf->SetFont("Arial","",08); 
$pdf->Cell(80,5,'NQF Level(see overleaf):',0,0,'L',0); 
$pdf->SetFont("Arial","B",08); 
$pdf->Cell(80,5,substr($record['NQFLevel'], -1),0,1,'L',0); 

$pdf->SetFont("Arial","",08); 
$pdf->Cell(80,5,'Credits:',0,0,'L',0); 
$pdf->SetFont("Arial","B",08); 
$pdf->Cell(80,5,$record['Credits'],0,1,'L',0); 


$pdf->Output(); //Output data to the PDF 
?> 
관련 문제