• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Seretos / tcpdf-markdown / 17508958800

06 Sep 2025 02:47AM UTC coverage: 67.411% (-25.7%) from 93.103%
17508958800

push

github

Seretos
add first tcpdf implementations

1 of 211 new or added lines in 7 files covered. (0.47%)

513 of 761 relevant lines covered (67.41%)

21.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Tcpdf/Pdf.php
1
<?php
2
declare(strict_types=1);
3
/**
4
 * author:  aappen
5
 * project: tcpdf-markdown
6
 */
7

8
namespace seretos\TCPDFMarkdown\Tcpdf;
9

10
use TCPDF;
11

12
class Pdf
13
{
14
    public function __construct(private readonly TCPDF $tcpdf)
15
    {
NEW
16
        $this->tcpdf->setCellPadding(.0);
×
17
    }
18

19
    public function getPageWidth(): float
20
    {
NEW
21
        return $this->tcpdf->getPageWidth();
×
22
    }
23

24
    public function getPageHeight(): float {
NEW
25
        return $this->tcpdf->getPageHeight();
×
26
    }
27

28
    public function getMarginLeft(): float
29
    {
NEW
30
        return $this->tcpdf->getMargins()['left'];
×
31
    }
32

33
    public function getMarginRight(): float
34
    {
NEW
35
        return $this->tcpdf->getMargins()['right'];
×
36
    }
37

38
    public function getMarginBottom(): float
39
    {
NEW
40
        return $this->tcpdf->getMargins()['bottom'];
×
41
    }
42

43
    public function getCellMarginLeft(): float {
NEW
44
        return $this->tcpdf->getCellMargins()['L'] ?? .0;
×
45
    }
46

47
    public function getCellMarginRight(): float {
NEW
48
        return $this->tcpdf->getCellMargins()['R'] ?? .0;
×
49
    }
50

51
    public function getCellPaddingLeft(): float {
NEW
52
        return $this->tcpdf->getCellPaddings()['L'] ?? .0;
×
53
    }
54

55
    public function getCellPaddingRight(): float {
NEW
56
        return $this->tcpdf->getCellPaddings()['R'] ?? .0;
×
57
    }
58

59
    public function write(string $s, float $height = .0, string $link = ''): void {
NEW
60
        $this->tcpdf->Write($height, $s, $link);
×
61
    }
62

63
    public function ln(): void {
NEW
64
        $this->tcpdf->Ln();
×
65
    }
66

67
    public function setFont(string $family, string $style = '', ?float $size = null): void {
NEW
68
        $this->tcpdf->setFont($family, $style, $size);
×
69
    }
70

71
    public function getStringHeight(string $s = 'J', string $family = 'helvetica', string $style = '', ?float $size = null): float {
NEW
72
        $this->tcpdf->setFont($family, $style, $size);
×
NEW
73
        return $this->tcpdf->getStringHeight($this->getStringWidth($s, $family, $style, $size)*2, $s);
×
74
    }
75

76
    public function getStringWidth(string $s, string $family = 'helvetica', string $style = '', ?float $size = null): float {
NEW
77
        $w = $this->tcpdf->GetStringWidth('A' . $s . 'A', $family, $style, $size);
×
NEW
78
        return $w - (2 * $this->tcpdf->GetStringWidth('A', $family, $style, $size));
×
79
    }
80

81
    public function getX(): float
82
    {
NEW
83
        return $this->tcpdf->GetX();
×
84
    }
85

86
    public function getY(): float {
NEW
87
        return $this->tcpdf->GetY();
×
88
    }
89

90
    public function setXY(float $x, float $y): static
91
    {
NEW
92
        $this->tcpdf->setXY($x, $y);
×
NEW
93
        return $this;
×
94
    }
95

96
    public function rectangle(float $x, float $y, float $width, float $height, string $style = '', ?array $backgroundColor = null, array $borderStyle = []): void {
NEW
97
        $this->tcpdf->Rect($x, $y, $width, $height, $style, $borderStyle, $backgroundColor ?? []);
×
98
    }
99

100
    public function setFontColor(?array $color): static {
NEW
101
        if($color !== null)
×
NEW
102
            $this->tcpdf->setTextColorArray($color);
×
103
        else
NEW
104
            $this->tcpdf->setTextColorArray([0,0,0]);
×
NEW
105
        return $this;
×
106
    }
107
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc