5
私はMySQL DBから動的ロードがあり、私のページURLはhttp://localhost/far/contractview?ID=137です。このページをPDFに変換しようとすると、いくつかのエラーが発生します。このページをPDFに変換するには、ボタンのクリックで何をすべきかわかりません。phpページをpdfに変換するID:
以下に私のコードを含めました。私はmpdf
を使用しています。
<?php
require("mpdf60/mpdf.php");
$mpdf=new mPDF('application/pdf','Letter-L','','',15,10,16,10,10,10);//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 "contractview.php";
include_once "users.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;
?>
ありがとうございます。
あなたが取得している "いくつかのエラー" どのようなものですか?リンクチェックアウト – bIgBoY
SCREAM:警告のためのエラー抑制が無視されました:include_once(contractview?ID = 137): – user2989676
ここにphp-to-pdf.phpのコードが必要です。ご覧のとおり、ファイルではなくURLを含めるようにしています。 – bIgBoY