This repository was archived by the owner on Apr 14, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,4 @@ before_install:
10
10
- sudo mv ./orbit /usr/local/bin && chmod +x /usr/local/bin/orbit
11
11
12
12
script :
13
- - orbit run lint
13
+ - orbit run lint up tests
Original file line number Diff line number Diff line change @@ -7,6 +7,15 @@ final class OfficeRequest extends Request implements GotenbergRequestInterface
7
7
/** @var Document[] */
8
8
private $ files ;
9
9
10
+ /** @var float|null */
11
+ private $ paperWidth ;
12
+
13
+ /** @var float|null */
14
+ private $ paperHeight ;
15
+
16
+ /** @var bool */
17
+ private $ landscape ;
18
+
10
19
/**
11
20
* OfficeRequest constructor.
12
21
* @param Document[] $files
@@ -34,6 +43,13 @@ public function getFormValues(): array
34
43
if (!empty ($ this ->webhookURL )) {
35
44
$ values [self ::WEBHOOK_URL ] = $ this ->webhookURL ;
36
45
}
46
+ if (!is_null ($ this ->paperWidth )) {
47
+ $ values [self ::PAPER_WIDTH ] = $ this ->paperWidth ;
48
+ }
49
+ if (!is_null ($ this ->paperHeight )) {
50
+ $ values [self ::PAPER_HEIGHT ] = $ this ->paperHeight ;
51
+ }
52
+ $ values [self ::LANDSCAPE ] = $ this ->landscape ;
37
53
return $ values ;
38
54
}
39
55
@@ -48,4 +64,25 @@ public function getFormFiles(): array
48
64
}
49
65
return $ files ;
50
66
}
67
+
68
+ /**
69
+ * @param float[] $paperSize
70
+ * @throws RequestException
71
+ */
72
+ public function setPaperSize (array $ paperSize ): void
73
+ {
74
+ if (count ($ paperSize ) !== 2 ) {
75
+ throw new RequestException ('Wrong paper size. ' );
76
+ }
77
+ $ this ->paperWidth = $ paperSize [0 ];
78
+ $ this ->paperHeight = $ paperSize [1 ];
79
+ }
80
+
81
+ /**
82
+ * @param bool $landscape
83
+ */
84
+ public function setLandscape (bool $ landscape ): void
85
+ {
86
+ $ this ->landscape = $ landscape ;
87
+ }
51
88
}
Original file line number Diff line number Diff line change @@ -85,13 +85,15 @@ public function createMarkdownRequest(): MarkdownRequest
85
85
86
86
/**
87
87
* @return OfficeRequest
88
+ * @throws RequestException
88
89
*/
89
90
public function createOfficeRequest (): OfficeRequest
90
91
{
91
92
$ files = [
92
93
DocumentFactory::makeFromPath ('document.docx ' , __DIR__ . '/assets/office/document.docx ' ),
93
94
];
94
95
$ request = new OfficeRequest ($ files );
96
+ $ request ->setPaperSize (Request::A4 );
95
97
return $ request ;
96
98
}
97
99
You can’t perform that action at this time.
0 commit comments