我有一个动态网页,我使用html和php创建...我已经有可以将静态网页转换为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>