php - 使用 PHP 从 HTML 文件生成 PDF 文件
问题描述
我正在尝试使用 PHP 从 HTML 页面生成 PDF。我正在使用 fpdf 库将 HTML 转换为 pdf。但是代码不能正常工作。谁能帮我找出我的代码的错误?
<?php
require('fpdf.php');
if (isset($_POST['signup'])) {
$pdf=new FPDF();
$pdf->AddPage();
$fp = fopen("index.html","r");
$strContent = fread($fp, filesize("index.html"));
fclose($fp);
$pdf->WriteHTML($strContent);
$pdf->Output();
}
?>
这是我正在尝试的 PHP 代码。
解决方案
推荐阅读
- javascript - 如何从本地存储中获取数据并设置状态反应
- css - React-tooltip 和 Next.js SSR 问题
- python - 如何在 for 循环中创建新的 Excel 工作表?
- vb.net - 在 vb.net 中自动生成 id 号
- regex - 是否可以在 Visual Studio Code 的占位符转换中添加变量?
- sql - Postgresql 选择查询解决方案
- r - R可以用ggplot反转调色板吗?
- android - 无法返回上一页
- c# - GroupBy 和按条件计数实体框架
- javascript - Bootstrap-vue 将 svg 图像显示为导航项?