我有一个没有样式属性的 html 页面。我使用的 HTML 标记是“中心、换行标记、粗体标记”。HTML 页面不包含任何表格。它是一个简单的文件。我需要帮助:-
- 在 pdf 文件的所有边添加 1 英寸的边距。
- 我想以两个制表符的空间开始每个段落。(“ ”在 html 文件中生成空间,但不在 pdf 文件中。)
我正在使用的代码:--
ob_start();
// start buffering and displaying page
echo 'All the content i m fetching according my requirements';
$file_name_string=substr($guid, 0, 8);
$file_name=$file_name_string.".htm";
file_put_contents($file_name, ob_get_contents());
// end buffering and displaying page
ob_end_flush();
$output_file=$file_name_string.".pdf";
require('html2fpdf.php');
$pdf=new HTML2FPDF();
$pdf->SetFont('Arial','B',12);
$pdf->AddPage();
$fp = fopen($file_name,"r");
$strContent = fread($fp, filesize($file_name));
fclose($fp);
$pdf->WriteHTML($strContent);
$pdf->Output($output_file);