我正在制作HTML PDF模板,我即将设置背景图片。
以下是我的代码:
<?php
class pdfAction extends sfAction{
public function execute($request){
$id = $request->getParameter('id');
if(!$id){
return $this->forward404();
}
$testTemplate = Doctrine_Core::getTable('PrintManual')->findOneById($id);
if(!$testTemplate){
return $this->forward404();
}
$config = sfTCPDFPluginConfigHandler::loadConfig('my_config');
sfTCPDFPluginConfigHandler::includeLangFile($this->getUser()->getCulture());
$pdf = new sfTCPDF();
$pdf->SetTitle('Precena Biz - Test Template');
$pdf->SetSubject('Precena Biz - Test Template');
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$content = myTools::loadTemplate('pdfTpl',array('test'=>$testTemplate), sfConfig::get('sf_root_dir') . '/apps/AdmSys/modules/test/templates');
$pdf->AddPage();
$pdf->SetFont('kochiminchosubst', "", 13);
$pdf->writeHTML($content, true, 0);
//$pdf->AddI();
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->Output('test.pdf', 'I');
throw new sfStopException();
return $this->renderText('');
}
}
如何将图像添加或设置为背景?