php mpdf增加了pdf的大小

时间:2016-03-31 11:20:17

标签: mpdf

PDF doc generated for me

附加的图像是pdf文档,我通过使用MPDf库包含特定的php文件,通过单击自动生成, 任何人都可以帮助我如何增加文本的大小,使其清晰可见,这是我的代码,以提前转换为PDF格式。

<?php 

require("mpdf60/mpdf.php");
$mpdf=new mPDF('utf-8','A3-L');//A4 page in portrait for landscape add -L.
$mpdf->debug = true;
$mpdf->allow_output_buffering = true;
//$mpdf->SetHeader('|Your Header here|');
//$mpdf->setFooter('{PAGENO}');// Giving page number to your footer.
//$mpdf->useOnlyCoreFonts = true;    // false is default
$mpdf->SetDisplayMode('fullpage');
// Buffer the following html with PHP so we can store it to a variable later
ob_start();
?>
<?php 

include_once "viewcomp.php";
 //This is your php page ?>
<?php 
$html = ob_get_contents();
ob_end_clean();
// send the captured HTML from the output buffer to the mPDF class for processing
$mpdf->WriteHTML($html);
//$mpdf->SetProtection(array(), 'user', 'password'); uncomment to protect your pdf page with password.
$mpdf->Output();
exit;
?>

2 个答案:

答案 0 :(得分:1)

mPDF使用自动调整表,这也会影响字体大小。使用mPDF输出表时,需要设置:

<table style="overflow: wrap">
根据此answer在每个表上

您可以按$mpdf->SetFontSize(6);设置字体大小。此处字体大小以点(pt)衡量。或者您可以使用mpdf函数SetDefaultFontSize()设置默认字体大小。根据MPDF文件,SetDefaultFontSize()被删除但仍然可用。另一种方法是编辑mpdf默认样式表(mpdf.css)。

希望这可能会有所帮助

答案 1 :(得分:0)

请使用

while ($row = fgetcsv($fp, "1024", ",")) {
// here $row contains all the columns in it in a numeric array
// Means 0 => first column of csv, 2 => second column of csv and so on

// you can convert any specific column value like
$json[] = array($row[0], setype($row[0], "string"), and so on);