Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Pdf\Document;
16
17use Pop\Pdf\Document\Page\Annotation;
18
19/**
20 * Pdf page interface
21 *
22 * @category   Pop
23 * @package    Pop\Pdf
24 * @author     Nick Sagona, III <nick@popphp.org>
25 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
26 * @license    https://www.popphp.org/license     New BSD License
27 * @version    6.0.0
28 */
29interface PageInterface
30{
31
32    /**
33     * Set the page width
34     *
35     * @param  mixed $width
36     * @return PageInterface
37     */
38    public function setWidth(mixed $width): PageInterface;
39
40    /**
41     * Set the page height
42     *
43     * @param  mixed $height
44     * @return PageInterface
45     */
46    public function setHeight(mixed $height): PageInterface;
47
48    /**
49     * Set the page index
50     *
51     * @param  int $i
52     * @return PageInterface
53     */
54    public function setIndex(int $i): PageInterface;
55
56    /**
57     * Get the page width
58     *
59     * @return int
60     */
61    public function getWidth(): int;
62
63    /**
64     * Get the page height
65     *
66     * @return int
67     */
68    public function getHeight(): int;
69
70    /**
71     * Get the page index
72     *
73     * @return ?int
74     */
75    public function getIndex(): ?int;
76
77    /**
78     * Add an image to the PDF page
79     *
80     * @param  Page\Image $image
81     * @param  int|float  $x
82     * @param  int|float  $y
83     * @return PageInterface
84     */
85    public function addImage(Page\Image $image, int|float $x = 0, int|float $y = 0): PageInterface;
86
87    /**
88     * Add text to the PDF page
89     *
90     * @param  Page\Text $text
91     * @param  string    $fontStyle (can be either a reference to a font or a style)
92     * @param  int|float $x
93     * @param  int|float $y
94     * @return PageInterface
95     */
96    public function addText(Page\Text $text, string $fontStyle, int|float $x = 0, int|float $y = 0): PageInterface;
97
98    /**
99     * Add an annotation to the PDF page
100     *
101     * @param  Annotation\AbstractAnnotation $annotation
102     * @param  int|float                     $x
103     * @param  int|float                     $y
104     * @return PageInterface
105     */
106    public function addAnnotation(Annotation\AbstractAnnotation $annotation, int|float $x = 0, int|float $y = 0): PageInterface;
107
108    /**
109     * Add a URL annotation to the PDF page
110     *
111     * @param  Annotation\Url $url
112     * @param  int|float      $x
113     * @param  int|float      $y
114     * @return PageInterface
115     */
116    public function addUrl(Annotation\Url $url, int|float $x = 0, int|float $y = 0): PageInterface;
117
118    /**
119     * Add a link annotation to the PDF page
120     *
121     * @param  Annotation\Link $link
122     * @param  int|float       $x
123     * @param  int|float       $y
124     * @return PageInterface
125     */
126    public function addLink(Annotation\Link $link, int|float $x = 0, int|float $y = 0): PageInterface;
127
128    /**
129     * Add a path to the Pdf page
130     *
131     * @param  Page\Path $path
132     * @return PageInterface
133     */
134    public function addPath(Page\Path $path): PageInterface;
135
136    /**
137     * Get image objects
138     *
139     * @return array
140     */
141    public function getImages(): array;
142
143    /**
144     * Get text objects
145     *
146     * @return array
147     */
148    public function getText(): array;
149
150    /**
151     * Get annotation objects
152     *
153     * @return array
154     */
155    public function getAnnotations(): array;
156
157    /**
158     * Get path objects
159     *
160     * @return array
161     */
162    public function getPaths(): array;
163
164    /**
165     * Determine if the page has image objects
166     *
167     * @return bool
168     */
169    public function hasImages(): bool;
170
171    /**
172     * Determine if the page has text objects
173     *
174     * @return bool
175     */
176    public function hasText(): bool;
177
178    /**
179     * Determine if the page has annotation objects
180     *
181     * @return bool
182     */
183    public function hasAnnotations(): bool;
184
185    /**
186     * Determine if the page has path objects
187     *
188     * @return bool
189     */
190    public function hasPaths(): bool;
191
192}