dompdf样式不能在服务器中工作
问题描述:
我使用dompdf库与codeigniter生成报告为html。在这种情况下,pdf是在本地机器上生成的。但是,当我上传相同的代码到服务器机器样式不起作用。但我检查相关的html页面。它与样式一起显示。dompdf样式不能在服务器中工作
这是我的图书馆档案。
<?php
require_once(dirname(__FILE__) . '/dompdf/dompdf_config.inc.php');
class pdf extends DOMPDF
{
private $html = '';
protected function ci()
{
return get_instance();
}
public function load_view($view, $data = array())
{
$this->html .= $this->ci()->load->view($view, $data, TRUE);
}
public function render($file)
{
// echo $this->html; die;
$this->load_html($this->html);
parent::render();
$this->stream($file);
}
}
我尝试检查HTML去除echo $this->html; die;
评论后这是我的行动
public function download()
{
$this->load->library('pdf');
$this->pdf->load_view('pdf/header');
$this->pdf->load_view('pdf/test');
$this->pdf->load_view('pdf/footer');
$this->pdf->render('ttt.pdf');
}
,并享有
PDF /头
<!DOCTYPE html>
<html>
<head>
<title>dddd</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="<?php print base_url(); ?>css/pdf.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="container">
<div id="header">
<a href="<?php print base_url(); ?>">
<h2>ddddd</h2>
</a>
</div>
<div id="main">
PDF /吨EST
<h3>SECTION 17 APPLICATION</h3>
<h4>1) Particulars of Investors</h4>
<table class="table table-bordered">
<thead>
<tr>
<th></th>
<th>US $ Min</th>
<th>%</th>
</tr>
</thead>
<tbody>
<tr>
<td>a) Name :- </td>
<td>tttttt</td>
<td>dfsdfsdf</td>
</tr>
</tbody>
</table>
PDF /页脚
</div>
<footer>
© <?php print date('Y'); ?> ddddd. All Rights Reserved
</footer>
</body>
</html>
哪个DOMPDF的版本? 'base_url()'返回类似'http://example.com ...'的东西。如果是这样,您可能需要将DOMPDF_ENABLE_REMOTE设置为true。 – BrianS