1+ <?php
2+
3+ namespace Nilgems \PhpTextract \ExtractorService \Options ;
4+
5+ use Nilgems \PhpTextract \ExtractorService \Options \Contracts \AbstractOptions ;
6+
7+ class PdfOptions extends AbstractOptions
8+ {
9+ /**
10+ * Specifies the first page to convert.
11+ * @var int|null $firstPage
12+ */
13+ public ?int $ firstPage = null ;
14+ /**
15+ * Specifies the last page to convert.
16+ * @var int|null $lastPage
17+ */
18+ public ?int $ lastPage = null ;
19+ /**
20+ * Specifies the resolution, in DPI. The default is 72 DPI.
21+ * @var int|null $resolution
22+ */
23+ public ?int $ resolution = null ;
24+ /**
25+ * Specifies the x-coordinate of the crop area top left corner
26+ * @var int|null
27+ */
28+ public ?int $ xCoordinate = null ;
29+ /**
30+ * Specifies the y-coordinate of the crop area top left corner
31+ * @var int|null $yCoordinate
32+ */
33+ public ?int $ yCoordinate = null ;
34+ /**
35+ * Specifies the width of crop area in pixels (default is 0)
36+ * @var int|null
37+ */
38+ public ?int $ widthOfCorpArea = null ;
39+ /**
40+ * Specifies the height of crop area in pixels (default is 0)
41+ * @var int|null
42+ */
43+ public ?int $ heightOfCorpArea = null ;
44+ /**
45+ * Maintain (as best as possible) the original physical layout of the text. The default is to ´undo'
46+ * physical layout (columns, hyphenation, etc.) and output the text in reading order.
47+ * @var bool $layoutModeEnabled
48+ */
49+ public bool $ layoutModeEnabled = false ;
50+
51+ /**
52+ * Assume fixed-pitch (or tabular) text, with the specified character width (in points). This forces
53+ * physical layout mode.
54+ * @var int|null $fixedPitch
55+ */
56+ public ?int $ fixedPitch = null ;
57+ /**
58+ * Keep the text in content stream order. This is a hack which often "undoes" column formatting,
59+ * etc. Use of raw mode is no longer recommended.
60+ * @var bool $rawEnabled
61+ */
62+ public bool $ rawEnabled = false ;
63+ /**
64+ * Sets the encoding to use for text output. This defaults to "UTF-8".
65+ * @var string|null $encodingName
66+ */
67+ public ?string $ encodingName = null ;
68+ /**
69+ * Don't insert page breaks (form feed characters) between pages.
70+ * @var bool $pdfNoPageBreaks
71+ */
72+ public bool $ noPageBreaksEnabled = false ;
73+ /**
74+ * Specify the owner password for the PDF file. Providing this will bypass all security
75+ * restrictions.
76+ * @var string|null $ownerPassword
77+ */
78+ public ?string $ ownerPassword = null ;
79+ /**
80+ * Specify the user password for the PDF file.
81+ * @var string|null $userPassword
82+ */
83+ public ?string $ userPassword = null ;
84+
85+
86+
87+ /**
88+ * Specifies the first page to convert.
89+ * @param int $pageNo
90+ * @return $this
91+ */
92+ public function addFirstPage (int $ pageNo ): static
93+ {
94+ $ this ->firstPage = $ pageNo ;
95+ return $ this ;
96+ }
97+
98+ /**
99+ * Specifies the last page to convert.
100+ * @param int $pageNo
101+ * @return $this
102+ */
103+ public function addLastPage (int $ pageNo ): static
104+ {
105+ $ this ->lastPage = $ pageNo ;
106+ return $ this ;
107+ }
108+
109+ /**
110+ * Specifies the resolution, in DPI. The default is 72 DPI.
111+ * @param int $resolution
112+ * @return $this
113+ */
114+ public function addResolution (int $ resolution ): static
115+ {
116+ $ this ->resolution = $ resolution ;
117+ return $ this ;
118+ }
119+
120+ /**
121+ * Specifies the x-coordinate of the crop area top left corner
122+ * @param int $xCoordinate
123+ * @return $this
124+ */
125+ public function addXCoordinate (int $ xCoordinate ): static
126+ {
127+ $ this ->xCoordinate = $ xCoordinate ;
128+ return $ this ;
129+ }
130+
131+ /**
132+ * Specifies the y-coordinate of the crop area top left corner
133+ * @param int $yCoordinate
134+ * @return $this
135+ */
136+ public function addYCoordinate (int $ yCoordinate ): static
137+ {
138+ $ this ->yCoordinate = $ yCoordinate ;
139+ return $ this ;
140+ }
141+
142+ /**
143+ * Specifies the width of crop area in pixels (default is 0)
144+ * @param int $width
145+ * @return $this
146+ */
147+ public function addWidthOfCorpArea (int $ width ): static
148+ {
149+ $ this ->widthOfCorpArea = $ width ;
150+ return $ this ;
151+ }
152+
153+ /**
154+ * Specifies the height of crop area in pixels (default is 0)
155+ * @param int $height
156+ * @return $this
157+ */
158+ public function addHeightOfCorpArea (int $ height ): static
159+ {
160+ $ this ->heightOfCorpArea = $ height ;
161+ return $ this ;
162+ }
163+
164+ /**
165+ * Maintain (as best as possible) the original physical layout of the text. The default is to ´undo'
166+ * physical layout (columns, hyphenation, etc.) and output the text in reading order.
167+ * @return $this
168+ */
169+ public function useLayoutMode (): static
170+ {
171+ $ this ->layoutModeEnabled = true ;
172+ return $ this ;
173+ }
174+
175+ /**
176+ * Assume fixed-pitch (or tabular) text, with the specified character width (in points). This forces
177+ * physical layout mode.
178+ * @param int $pitch
179+ * @return $this
180+ */
181+ public function addFixedPitch (int $ pitch ): static
182+ {
183+ $ this ->fixedPitch = $ pitch ;
184+ return $ this ;
185+ }
186+
187+ /**
188+ * Keep the text in content stream order. This is a hack which often "undoes" column formatting,
189+ * etc. Use of raw mode is no longer recommended.
190+ * @return $this
191+ */
192+ public function useRaw (): static
193+ {
194+ $ this ->rawEnabled = true ;
195+ return $ this ;
196+ }
197+
198+ /**
199+ * Sets the encoding to use for text output. This defaults to "UTF-8".
200+ * @param string $encodingName
201+ * @return $this
202+ */
203+ public function addEncodingName (string $ encodingName ): static
204+ {
205+ $ this ->encodingName = $ encodingName ;
206+ return $ this ;
207+ }
208+
209+ /**
210+ * Don't insert page breaks (form feed characters) between pages.
211+ * @return $this
212+ */
213+ public function useNoPageBreak (): static
214+ {
215+ $ this ->noPageBreaksEnabled = true ;
216+ return $ this ;
217+ }
218+
219+ /**
220+ * Specify the owner password for the PDF file. Providing this will bypass all security
221+ * restrictions.
222+ * @param string $password
223+ * @return $this
224+ */
225+ public function addOwnerPassword (string $ password ): static
226+ {
227+ $ this ->ownerPassword = $ password ;
228+ return $ this ;
229+ }
230+
231+ /**
232+ * Specify the user password for the PDF file.
233+ * @param string $password
234+ * @return $this
235+ */
236+ public function addUserPassword (string $ password ): static
237+ {
238+ $ this ->userPassword = $ password ;
239+ return $ this ;
240+ }
241+ }
0 commit comments