您好我正在使用DOMPDF生成PDF文件,我想知道如何獲取頁碼。dompdf頁碼
我在DOMPDF的常見問題頁面中嘗試了以下內容。並沒有成功。 注:我也有轉內聯PHP,以及它在幫助提
下面是我的代碼
<?php
require_once("dompdf/dompdf_config.inc.php");
ob_start();
//be sure this file exists, and works outside of web context etc.)
$dompdf = new DOMPDF();
$html=" <script type='text/php'>";
if (isset($pdf)) {
$font = Font_Metrics::get_font("yourfont", "normal");
$size = 9;
$y = $pdf->get_height() - 24;
$x = $pdf->get_width() - 15 - Font_Metrics::get_text_width("1/1", $font, $size);
$pdf->page_text($x, $y, "{PAGE_NUM}/{PAGE_COUNT}", $font, $size);
}
$html.=" </script>";
$html .="
aaaaa<br/>aaaaaa<br/>aaaaaa<br/>aaaaa<br/>aaaaaa<br/>aaaaaa<br/>aaaa<br/>aaaaa<br/>aaaaaa<br/>aaaaa<br/>
aaaaa<br/>aaaaaaa<br/>aaaaaa<br/>
aaaaa<br/>aaaaaa<br/>
aaaaaaa<br/>aaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>
aaaaaaa<br/>aaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>
aaaaaaaa<br/>aaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>
aaaaaaaa<br/>aaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>
aaaaaaaa<br/>aaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>
aaaaaaaaa<br/>aaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>
aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>aaaaaaaaaaaaaaaaa<br/>
</body></html>";
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>
有人能指出我出這個問題嗎?我在哪裏弄錯了