开发者

html2pdf is not recognizing space and not able to add margin

I am having a html page with no style attribute.HTML tags i am using are "center,line break tag, bold tag".Html page doesnot contain any table. its a simple document.I need help for:-

  1. Adding margin of 1 inch on all sides of the pdf file.
  2. I want to start every para with space of two tabs. ("&nbsp" generate space in html file but not in pdf file.)

Code i am using:--

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);
$开发者_如何学Gopdf->WriteHTML($strContent);
$pdf->Output($output_file);


Use

$pdf->SetMargins(20,18);

To add margins. I use this library myself to do a wide variety of crap on a pretty busy e-commerce site. I'll take a look through my code to see if I can come up with a solution on the paragraph indentation.

I'd like to add that this library is GREAT for what it does, but it is sometimes very frustrating in its limitations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜