make pdf remote sources inline

parent 3bee787f
......@@ -47,12 +47,14 @@ class ApplicationFormPdf
$html = $this->view->fetch('application_form/pdf.twig', [
'school' => $school,
'appForm' => $appForm,
'logo' => base64_encode(file_get_contents(__DIR__ . '/../../public/img/application_form/minedu_logo.jpg')),
'style' => file_get_contents(__DIR__ . '/../../public/css/application_form/pdf.css'),
]);
$pdf = new \Dompdf\Dompdf([
'default_paper_size' => 'A4',
'default_font' => 'DejaVu Sans',
'isHtml5ParserEnabled' => true,
'is_remote_enabled' => true,
'is_remote_enabled' => false,
]);
$pdf->loadHtml($html);
$pdf->render();
......
......@@ -197,5 +197,5 @@
{{ parent() }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.3/backbone-min.js"></script>
<script src="{{ base_url }}/js/application_form/index.js"></script>
<script src="{{ base_url() }}/js/application_form/index.js"></script>
{% endblock %}
<!DOCTYPE html>
<html>
<head>
<link href="{{ base_url() }}/css/application_form/pdf.css" rel="stylesheet" type="text/css">
<meta charset="UTF-8">
<style type="text/css">
{{ style|raw }}
</style>
</head>
<body>
<div class="header">
<img src="{{ base_url() }}/img/minedu_logo.jpg">
<img src="data:image/jpg;base64,{{ logo|raw }}">
<div class="h1">
EduLabs<br>
<a href="{{ base_url() }}">{{ base_url() }}</a>
......
......@@ -46,7 +46,9 @@
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="4"></td>
</tr>
</tfoot>
</table>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment