-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestpdf.php
More file actions
43 lines (38 loc) · 1.08 KB
/
testpdf.php
File metadata and controls
43 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
// Require composer autoload
require_once __DIR__ . '/lib/mpdf/vendor/autoload.php';
define('_MPDF_TTFONTPATH', __DIR__ . '/ttfonts');
// Create an instance of the class:
$mpdf = new \Mpdf\Mpdf();
// Write some HTML code:
$defaultConfig = (new Mpdf\Config\ConfigVariables())->getDefaults();
$fontDirs = $defaultConfig['fontDir'];
$defaultFontConfig = (new Mpdf\Config\FontVariables())->getDefaults();
$fontData = $defaultFontConfig['fontdata'];
$mpdf = new \Mpdf\Mpdf([
'fontDir' => array_merge($fontDirs),
'fontdata' => $fontData + [
'freesans' => [
'R' => 'FreeSans.ttf',
'B' => 'FreeSansBold.ttf',
]
],
'default_font' => 'freesans'
]);
$html='<!DOCTYPE html>
<html>
<head>
<title>Customer Report</title>
<meta http-equiv="Content-Language" content="hi">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p lang="hi">
Customer Report
</p>
</body>
</html>';
$mpdf->WriteHTML($html);
// Output a PDF file directly to the browser
$mpdf->Output();
?>