forked from mpdf/mpdf
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIssue643Test.php
More file actions
84 lines (57 loc) · 1.45 KB
/
Issue643Test.php
File metadata and controls
84 lines (57 loc) · 1.45 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
namespace Issues;
class Issue643Test extends \Mpdf\BaseMpdfTest
{
public function testTocPageBreak()
{
$html = '
<style>
@page {
footer: html_myFooter;
}
</style>
<htmlpagefooter name="myFooter">
Page {PAGENO} / {nbpg}
</htmlpagefooter>
<tocpagebreak links="on" />
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h2>Heading 2</h2>
<h2>Heading 2</h2>
<pagebreak />
<h1>Heading 1</h1>';
$this->mpdf->h2toc = array('H1' => 0, 'H2' => 1);
$this->mpdf->setCompression(false);
$this->mpdf->WriteHTML($html);
$this->mpdf->Close();
$this->assertSame(1, $this->mpdf->docPageNum(1));
$this->assertSame(2, $this->mpdf->docPageNum(2));
$this->assertSame(3, $this->mpdf->docPageNum(3));
}
public function testTocPageBreakReset()
{
$html = '
<style>
@page {
footer: html_myFooter;
}
</style>
<htmlpagefooter name="myFooter">
Page {PAGENO} / {nbpg}
</htmlpagefooter>
<tocpagebreak links="on" resetpagenum="1" />
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h2>Heading 2</h2>
<h2>Heading 2</h2>
<pagebreak />
<h1>Heading 1</h1>';
$this->mpdf->h2toc = array('H1' => 0, 'H2' => 1);
$this->mpdf->setCompression(false);
$this->mpdf->WriteHTML($html);
$this->mpdf->Close();
$this->assertSame(1, $this->mpdf->docPageNum(1));
$this->assertSame(1, $this->mpdf->docPageNum(2));
$this->assertSame(2, $this->mpdf->docPageNum(3));
}
}