我正在尝试使用数据库中的一些数据和一些图像保存一个 pdf。我可以正常保存,但图像不显示。$ft1、$ft2 和 $ft3 是带有图像名称的数据库变量。
这是我的测试代码:
require_once('../tcpdf/config/lang/bra.php');
require_once('../tcpdf/tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 006');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
$html.= "<div><img src='../uploads/".$ft1."' width='200' height='400' /><br><br><img src='../uploads/".$ft2."' /><br><br><img src='../../uploads/".$ft3."' /></div>";
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->lastPage();
ob_clean();
$pdf->Output('../uploads/'.$norepeat.'_relatorio_'.$idcontrato.'_'.formatDataJustNumbers($_POST['datarelatorio']).'.pdf', 'F');