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

LibreSign / libresign / 3717593689

pending completion
3717593689

Pull #1287

github

GitHub
Merge 42fe701e4 into ff8c1edaf
Pull Request #1287: [stable25] Bump packages

2548 of 4384 relevant lines covered (58.12%)

4.74 hits per line

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

26.09
/lib/Handler/TCPDILibresign.php
1
<?php
2

3
namespace OCA\Libresign\Handler;
4

5
use TCPDI;
6

7
class TCPDILibresign extends TCPDI {
8
        /**
9
         * @var bool
10
         */
11
        protected $tcpdflink = false;
12
        public function __construct($orientation = 'P', $unit = 'px', $format = 'A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false, $pdfa = false) {
13
                parent::__construct($orientation, $unit, $format, $unicode, $encoding, $diskcache, $pdfa);
4✔
14
                $this->setPrintHeader(false);
4✔
15
                $this->setPrintFooter(false);
4✔
16
        }
17

18
        /**
19
         * @inheritDoc
20
         */
21
        protected function _textstring($s, $n = 0) {
22
                if (preg_match('/TCPDF.*\(http.*\)/', $s)) {
4✔
23
                        $s = 'LibreSign (https://libresign.coop)';
4✔
24
                }
25
                return parent::_textstring($s, $n);
4✔
26
        }
27

28
        /**
29
         * @psalm-return array{w?: mixed, h?: mixed}
30
         */
31
        public function getPageTplDimension(int $pageNum): array {
32
                if (!$this->tpls) {
×
33
                        return [];
×
34
                }
35
                return [
×
36
                        'w' => $this->tpls[$pageNum]['w'],
×
37
                        'h' => $this->tpls[$pageNum]['h']
×
38
                ];
×
39
        }
40

41
        public function getPagesMetadata(): array {
42
                $pageCount = current($this->parsers)->getPageCount();
×
43
                $data = [
×
44
                        'p' => $pageCount
×
45
                ];
×
46
                for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
×
47
                        $dimensions = $this->getPageTplDimension($pageNo);
×
48
                        if (empty($dimensions['w'])) {
×
49
                                $this->importPage($pageNo);
×
50
                                $dimensions = $this->getPageTplDimension($pageNo);
×
51
                        }
52
                        $data['d'][] = $dimensions;
×
53
                }
54
                return $data;
×
55
        }
56
}
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

© 2025 Coveralls, Inc