主元素应与PDF输出中所有页面的大小相等。请查看下面的图片以获得所需的输出。
$this->load->library("Pdf");
$pdf = new Pdf($orientation, 'mm', $papersize, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->setHtmlHeader($this->input->post('htmltopdfheader'));
$pdf->setHtmlFooter($this->input->post('htmltopdffooter'));
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(10, 77.5, 10);
$pdf->SetHeaderMargin(2);
$pdf->SetFooterMargin(80);
$pdf->SetAutoPageBreak(TRUE, 80);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->AddPage();
$pdf->MultiCell(190,139, $this->input->post('htmltopdfcontent'), 1, 'J', false, 1, 10, 78, false, 1, true, true, 190, 'T');
ob_clean();
$pdf->Output();
}