我有一個動態的網頁,我創建使用HTML和PHP ...我已經有示例代碼,可以將靜態網頁轉換爲PDF ...但我的問題是我的網頁是動態的...所以有一個將我的頁面轉換爲pdf的方式? 無論如何,這裏是我的代碼:如何將動態網頁轉換爲pdf?
<?php
include_once("../classes/Receipt.php");
include_once("../classes/SalesDetail.php");
include_once("../classes/Business.php");
//session variable
$userID = 1;
$receipt = &new Receipt();
$receipt->queryReceiptInfo($userID);
$receiptID = $receipt->getReceiptID();
$receiptIssueDate = $receipt->getReceiptIssueDate();
$customer = $receipt->getCustomer();
$salesID = $receipt->getSalesID();
$salesDetail = &new SalesDetail($salesID);
$salesDetails = $salesDetail->viewSalesDetail();
//session variable
$businessID = 1;
$business = &new Business('', $businessID);
$business->queryBusinessName();
$businessName = $business->getBusinessName();
$rows = sizeof($salesDetails);
$columns = sizeof($salesDetails[0]);
?>
<table>
<tr>
<td>Receipt No.</td>
<td><?php echo $receiptID; ?></td>
<tr>
<tr>
<td>Date Issued</td>
<td><?php echo $receiptIssueDate; ?></td>
</tr>
<tr>
<td>Business</td>
<td><?php echo $businessName; ?></td>
</tr>
<tr>
<td>Customer</td>
<td><?php echo $customer; ?></td>
</tr>
</table>
<table>
<tr>
<td>Item</td>
<td>Quantity</td>
<td>Sub-Total</td>
</tr>
<?php
$totalPrice = 0;
for ($i = 0; $i < $rows; $i++) {
echo "<tr>";
for($j = 0; $j < $columns; $j++) {
echo "<td>".$salesDetails[$i][$j]."</td>";
}
$totalPrice += (double)$salesDetails[$i][2];
echo "</tr>";
}
?>
<tr>
<td></td>
<td>Total Price</td>
<td><?php echo $totalPrice;?></td>
</tr>
</table>