我使用 cakepdf 的 dompdf 引擎报告 cakephp 2.5.6 ,但我需要显示来自我的数据库并没有用。
使用'fullBase' => true;
并且不使用任何内容+ define('DOMPDF_ENABLE_REMOTE', true);
而不使用任何内容。
控制器:
public function boletasV($id = null) {
//$this->Comite->recursive = 2;
$this->pdfConfig = array(
'filename' => 'BoletasV.pdf',
'download' => (bool)$this->request->query('download')
);
$postulacion = $this->Comite->Postulacion->find('all', array('recursive' => 1,
'fields' => array(
'Postulacion.comite_id',
'Registro.nombre',
'Registro.apellido',
'Registro.foto',
'Registro.foto_dir'
)));
$comites = $this->Comite->find('all', array('recursive' => -1,'fields' => array('Comite.id','Comite.comite')));
$this->set(compact('postulacion', 'comites'));
}
来自bootstrap.php
:
Configure::write('CakePdf', array(
'engine' => 'CakePdf.DomPdf',
'options' => array(
'print-media-type' => true,
'outline' => true,
'dpi' => 96
),
'margin' => array(
'bottom' => 15,
'left' => 50,
'right' => 30,
'top' => 45
),
'pageSize' => 'A4',
'orientation' => 'landscape',
'download' => true,
'encoding' => 'UTF-8_encode'
));
define('DOMPDF_ENABLE_REMOTE', true);
这是我的观点测试:
<td><center><strong>Candidatos para el Organo: <br> <?php echo $comite['Comite']['comite']; ?></strong><br><br><br>
<?php foreach ($postulacion as $postulacions): ?>
<?php if($comite['Comite']['id'] === $postulacions['Postulacion']['comite_id']): ?>
<?php echo $this->Html->image('ovalo.png', array('fullBase'=>true)). ' - ' . $this->Html->image('../files/registro/foto/' . $postulacions['Registro']['foto_dir'] . '/' .'thumb_' . $postulacions['Registro']['foto'], array('fullBase' => true)). ' ' . h($postulacions['Registro']['nombre']. ' ' .$postulacions['Registro']['apellido']); ?><br>
<?php endif; ?>
<?php endforeach; ?>