PHP에서 FPDF 라이브러리를 사용하여 PDF를 생성했습니다.PHP의 FPDF 라이브러리에서 서식 지정
Student Details Parent Details
Username: abc123 Name: Mathew
Name: John Occupation: Businessman
어떤 변화 :이 같은 출력을 필요
Student Details
Username: abc123
Name: John
Parent Details
Name: Mathew
Occupation: Businessman
그러나 :
이<?php
require("fpdf181/fpdf.php");
class PDF extends FPDF
{
//Page header
function Header()
{
}
//Page footer
function Footer()
{
}
}
$pdf = new PDF('P', 'mm', 'A4');
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial','U',14);
$pdf->MultiCell(90, 8, "Student Details", 0, 'L');
$pdf->SetFont('Arial','B',12);
$pdf->Cell(32, 8, "Username: ");
$pdf->SetFont('Arial','',12);
$pdf->Cell(10, 8, 'abc123', 0, 1);
$pdf->SetFont('Arial','B',12);
$pdf->Cell(32, 8, "Name: ");
$pdf->SetFont('Arial','',12);
$pdf->Cell(10, 8, 'John', 0, 1);
$pdf->SetFont('Arial','U',14);
$pdf->MultiCell(90, 8, "Parent Details", 0, 'L');
$pdf->SetFont('Arial','B',12);
$pdf->Cell(32, 8, "Name: ");
$pdf->SetFont('Arial','',12);
$pdf->Cell(10, 8, 'Mathew', 0, 1);
$pdf->SetFont('Arial','B',12);
$pdf->Cell(32, 8, "Occupation: ");
$pdf->SetFont('Arial','',12);
$pdf->Cell(10, 8, 'Businessman', 0, 1);
$pdf->Output();
?>
지금은 다음과 같습니다 PDF 파일을 생성 : PDF를 생성 내 다음 코드를 고려하시기 바랍니다 이런 형식의 형식을 만들기 위해 내 코드에서 작성해야합니까?
이것은 간단한 접근 방법입니다. 나는 PDF를 로딩하는 것을 지연시킬 복잡한 테이블을 만드는 대신에 동일하게하고있다. 제안 해 주셔서 감사합니다. –