Php(html テーブル) から Pdf に変換する必要があります。変換には DOM PDf を使用しました。しかし、私はpdfで適切なビューを取得できませんでした。以下の画像を見つけてください。
PDF表示
HTML ビュー
以下のコード:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<?php if(count($this->userDetails)>=1){ for($a=0;$a<count($this->userDetails);$a++){ $user = $this->userDetails[$a]; ?>
<body>
<div style="background-image: url(http://192.168.2.26/skins/schooladmin/images/id_bg.png); background-repeat: repeat; width:400px; height:220px;margin:10px 0px 0px 10px;float:left;position:relative;">
<table style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold; color:#fff; background-image:url(http://192.168.2.26/skins/schooladmin/images/id_white_bg.png); background-repeat:no-repeat;" width="100%" border="0" cellpadding="5" cellspacing="5">
<tr>
<td style="background-image: url(http://192.168.2.26/skins/schooladmin/images/schoollogo.png); background-repeat:no-repeat; width:36px; height:61px;"> </td>
<td colspan="2"><?php echo $this->schoolDetails['name'] ?></td>
</tr>
<?php
if($user){
$user['userdetails']['name'] = $user['userdetails']['firstname'].$user['userdetails']['lastname'];
$photoPath = BASE_PATH."/uploads/photos/student/".$user['userdetails']['photo'];
if(!file_exists($photoPath)){
$photoPath = BASE_PATH."/skins/schooladmin/images/id_photo.png";
}
}else{
$photoPath = BASE_PATH."/skins/schooladmin/images/id_photo.png";
}
?>
<tr>
<td style="background-image: url(<?php echo $photoPath; ?>); background-repeat:no-repeat; width:82px; height:82px;"> </td>
<td colspan="2">
<table width="100%" border="0" cellspacing="3" cellpadding="3" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#fff;" >
<?php if($this->templateDetails['template']){
for($i=0;$i<1;$i++){
for($j=0;$j<count($this->templateDetails['template_details']);$j++){
if($this->templateDetails['template_details'][$j]['type'] == "text" && $this->templateDetails['template_details'][$j]['page'] == "front"){
?>
<tr>
<td width="38%"><?php echo $this->templateDetails['template_details'][$j]['label']; ?></td>
<td width="62%"><?php echo @$user['userdetails'][$this->templateDetails['template_details'][$j]['field']]; ?></td>
</tr>
<?php } } } } ?>
</table>
</td>
</tr>
<tr>
<td colspan="3" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#fff;" align="center"><?php echo $this->schoolDetails['address'] ?>, <?php echo $this->schoolDetails['address2'] ?>, <?php echo $this->schoolDetails['city'] ?> - <?php echo $this->schoolDetails['zipcode'] ?></td>
</tr>
<tr>
<td colspan="3" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; color:#fff;" align="center">Ph: <?php echo $this->schoolDetails['contactno'] ?></td>
</tr>
</table>
</div>
<div style="background-image: url(http://192.168.2.26/skins/schooladmin/images/id_bg.png); background-repeat: repeat; width:400px; height:220px;margin:10px 0px 0px 10px;float:left;position:relative;">
<table style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold; color:#fff; background-image:url(http://192.168.2.26/skins/schooladmin/images/id_white_bg.png); background-repeat:no-repeat;" width="100%" border="0" cellpadding="5" cellspacing="5">
<?php if($this->templateDetails['template']){
for($i=0;$i<1;$i++){
for($j=0;$j<count($this->templateDetails['template_details']);$j++){
if($this->templateDetails['template_details'][$j]['type'] == "text" && $this->templateDetails['template_details'][$j]['page'] == "back"){
?>
<tr>
<td width="38%"><?php echo $this->templateDetails['template_details'][$j]['label']; ?></td>
<td width="62%"><?php echo @$user['userdetails'][$this->templateDetails['template_details'][$j]['field']]; ?></td>
</tr>
<?php } } } } ?>
</table>
</div>
<?php } } ?>
</body>
</html>