Skip to content

Commit 5b4542b

Browse files
committed
Fix CS fixer + composer-dependency
1 parent 6b5fd4b commit 5b4542b

File tree

6 files changed

+95
-96
lines changed

6 files changed

+95
-96
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"symfony/http-foundation": "^6.4 || ^7.0",
3333
"symfony/http-kernel": "^6.4 || ^7.0",
3434
"symfony/mime": "^6.4 || ^7.0",
35+
"symfony/security-core": "^6.4 || ^7.0",
3536
"symfony/service-contracts": "^3.6"
3637
},
3738
"require-dev": {
@@ -50,7 +51,6 @@
5051
"symfony/http-client": "^6.4 || ^7.0",
5152
"symfony/monolog-bundle": "^3.10",
5253
"symfony/routing": "^6.4 || ^7.0",
53-
"symfony/security-bundle": "^6.4 || ^7.0",
5454
"symfony/stopwatch": "^6.4 || ^7.0",
5555
"symfony/twig-bundle": "^6.4 || ^7.0",
5656
"symfony/var-dumper": "^6.4 || ^7.0",
@@ -69,7 +69,6 @@
6969
"symfony/twig-bundle": "Allows you to use Twig to render templates into PDF.",
7070
"monolog/monolog": "Enables logging througout the generating process.",
7171
"async-aws/s3": "Upload any file to aws s3 compatible endpoints supporting multi part upload without memory overhead.",
72-
"league/flysystem-bundle": "Upload any file using this filesystem abstraction package.",
73-
"symfony/security-bundle": "Allows you to generate PDF as a specific user."
72+
"league/flysystem-bundle": "Upload any file using this filesystem abstraction package."
7473
}
7574
}

docs/pdf/customization.md

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
11
# PDF customization
22

3-
> [!NOTE]
3+
> [!NOTE]
44
> All of these functions are available for `HtmlPdfBuilder`, `UrlPdfBuilder` and
5-
> `MarkdownPdfBuilder`.
5+
> `MarkdownPdfBuilder`.
66
> To customize `LibreOfficePdfBuilder` see the related [documentation](office-builder.md).
77
88
## Available functions
99

1010
### Render
11-
[paperSize](#paperSize)
12-
[paperStandardSize](#paperStandardSize)
13-
[paperWidth](#paperWidth)
14-
[paperHeight](#paperHeight)
15-
[margins](#margins)
16-
[marginTop](#margins)
17-
[marginBottom](#margins)
18-
[marginLeft](#margins)
19-
[marginRight](#margins)
20-
[preferCssPageSize](#preferCssPageSize)
21-
[printBackground](#printBackground)
22-
[omitBackground](#omitBackground)
23-
[landscape](#landscape)
24-
[scale](#scale)
25-
[nativePageRanges](#nativePageRanges)
26-
[splitMode](#splitMode)
27-
[splitSpan](#splitSpan)
28-
[splitUnify](#splitUnify)
29-
30-
### Additional content
31-
[header and footer](#header-and-footer)
32-
[headerFile and footerFile](#headerfile-and-footerfile)
11+
[paperSize](#paperSize)
12+
[paperStandardSize](#paperStandardSize)
13+
[paperWidth](#paperWidth)
14+
[paperHeight](#paperHeight)
15+
[margins](#margins)
16+
[marginTop](#margins)
17+
[marginBottom](#margins)
18+
[marginLeft](#margins)
19+
[marginRight](#margins)
20+
[preferCssPageSize](#preferCssPageSize)
21+
[printBackground](#printBackground)
22+
[omitBackground](#omitBackground)
23+
[landscape](#landscape)
24+
[scale](#scale)
25+
[nativePageRanges](#nativePageRanges)
26+
[splitMode](#splitMode)
27+
[splitSpan](#splitSpan)
28+
[splitUnify](#splitUnify)
29+
30+
### Additional content
31+
[header and footer](#header-and-footer)
32+
[headerFile and footerFile](#headerfile-and-footerfile)
3333
[download from](#download-from)
3434

3535
### Style
36-
[assets](../assets.md)
37-
[addAsset](../assets.md)
36+
[assets](../assets.md)
37+
[addAsset](../assets.md)
3838

3939
### Request
40-
[waitDelay](#waitDelay)
41-
[waitForExpression](#waitForExpression)
42-
[emulatedMediaType](#emulatedMediaType)
43-
[cookies](#cookies)
44-
[setCookie](#setCookie)
45-
[addCookies](#addCookies)
46-
[forwardCookie](#forwardCookie)
47-
[forwardAuthentication](#forwardAuthentication)
48-
[asUser](#asUser)
49-
[userAgent](#userAgent)
50-
[extraHttpHeaders](#extraHttpHeaders)
51-
[addExtraHttpHeaders](#addExtraHttpHeaders)
52-
[failOnHttpStatusCodes](#failOnHttpStatusCodes)
53-
[failOnResourceHttpStatusCodes](#failOnResourceHttpStatusCodes)
54-
[failOnResourceLoadingFailed](#failOnResourceLoadingFailed)
55-
[failOnConsoleExceptions](#failOnConsoleExceptions)
56-
[skipNetworkIdleEvent](#skipNetworkIdleEvent)
40+
[waitDelay](#waitDelay)
41+
[waitForExpression](#waitForExpression)
42+
[emulatedMediaType](#emulatedMediaType)
43+
[cookies](#cookies)
44+
[setCookie](#setCookie)
45+
[addCookies](#addCookies)
46+
[forwardCookie](#forwardCookie)
47+
[forwardAuthentication](#forwardAuthentication)
48+
[asUser](#asUser)
49+
[userAgent](#userAgent)
50+
[extraHttpHeaders](#extraHttpHeaders)
51+
[addExtraHttpHeaders](#addExtraHttpHeaders)
52+
[failOnHttpStatusCodes](#failOnHttpStatusCodes)
53+
[failOnResourceHttpStatusCodes](#failOnResourceHttpStatusCodes)
54+
[failOnResourceLoadingFailed](#failOnResourceLoadingFailed)
55+
[failOnConsoleExceptions](#failOnConsoleExceptions)
56+
[skipNetworkIdleEvent](#skipNetworkIdleEvent)
5757

5858
### Formatting
59-
[metadata](#metadata)
60-
[addMetadata](#addMetadata)
61-
[pdfFormat](#pdfFormat)
62-
[pdfUniversalAccess](#pdfUniversalAccess)
63-
[generateDocumentOutline](#generateDocumentOutline)
59+
[metadata](#metadata)
60+
[addMetadata](#addMetadata)
61+
[pdfFormat](#pdfFormat)
62+
[pdfUniversalAccess](#pdfUniversalAccess)
63+
[generateDocumentOutline](#generateDocumentOutline)
6464
[generateTaggedPdf](#generateTaggedPdf)
6565

6666
## Render
@@ -69,7 +69,7 @@
6969

7070
Default: `8.5 inches x 11 inches`
7171

72-
You can override the default paper size with `height`, `width` and `unit`.
72+
You can override the default paper size with `height`, `width` and `unit`.
7373
`unit` is optional but by default in inches.
7474

7575
```php
@@ -138,7 +138,7 @@ class MyInvoiceSize implements PaperSizeInterface
138138
{
139139
return 200;
140140
}
141-
141+
142142
public function unit(): Unit
143143
{
144144
return Unit::Inches;
@@ -150,7 +150,7 @@ class MyInvoiceSize implements PaperSizeInterface
150150

151151
Default: `8.5 inches`
152152

153-
You can override the default `width` and `unit`.
153+
You can override the default `width` and `unit`.
154154
`unit` is optional but by default in inches.
155155

156156
```php
@@ -182,7 +182,7 @@ class YourController
182182

183183
Default: `11 inches`
184184

185-
You can override the default `height` and `unit`.
185+
You can override the default `height` and `unit`.
186186
`unit` is optional but by default in inches.
187187

188188
```php
@@ -214,8 +214,8 @@ class YourController
214214

215215
Default: `0.39 inches` on all four sides
216216

217-
You can override the default margins, with the arguments `top`, `bottom`, `right`,
218-
`left` and `unit`.
217+
You can override the default margins, with the arguments `top`, `bottom`, `right`,
218+
`left` and `unit`.
219219
`unit` is optional but by default in inches.
220220

221221
```php
@@ -240,7 +240,7 @@ class YourController
240240
}
241241
```
242242

243-
Or you can override all margins individually with respective `unit`.
243+
Or you can override all margins individually with respective `unit`.
244244
`unit` is always optional but by default in inches.
245245

246246
```php
@@ -524,7 +524,7 @@ class YourController
524524

525525
## Additional content
526526

527-
> [!WARNING]
527+
> [!WARNING]
528528
> Every Header or Footer templates you pass to Gotenberg need to have
529529
> the following structure.
530530
> ```html
@@ -540,7 +540,7 @@ class YourController
540540
> </html>
541541
> ```
542542
>
543-
> Some other limitations exist about header and footer.
543+
> Some other limitations exist about header and footer.
544544
> For more information about [Header and Footer](https://gotenberg.dev/docs/routes#header-footer-chromium).
545545
546546
### header and footer
@@ -577,9 +577,9 @@ class YourController
577577
578578
### headerFile and footerFile
579579

580-
> [!WARNING]
580+
> [!WARNING]
581581
> As assets files, by default the HTML files are fetch in the assets folder of
582-
> your application.
582+
> your application.
583583
> If your HTML files are in another folder, you can override the default value
584584
> of assets_directory in your configuration file config/sensiolabs_gotenberg.yml.
585585
@@ -629,7 +629,7 @@ class YourController
629629

630630
### download from
631631

632-
> [!WARNING]
632+
> [!WARNING]
633633
> URL of the file. It MUST return a `Content-Disposition` header with a filename parameter.
634634
635635
To download files resource from URLs.
@@ -655,7 +655,7 @@ class YourController
655655
],
656656
[
657657
'url' => 'http://example.com/url/to/file',
658-
'extraHttpHeaders' =>
658+
'extraHttpHeaders' =>
659659
[
660660
'MyHeaderOne' => 'MyValue',
661661
'MyHeaderTwo' => 'MyValue',
@@ -1090,7 +1090,7 @@ class YourController
10901090

10911091
default: `None`
10921092

1093-
Return a 409 Conflict response if the HTTP status code from at least one resource
1093+
Return a 409 Conflict response if the HTTP status code from at least one resource
10941094
is not acceptable.
10951095

10961096
```php
@@ -1122,7 +1122,7 @@ class YourController
11221122

11231123
default: `false`
11241124

1125-
Return a 409 Conflict response if there are exceptions to load at least one resource
1125+
Return a 409 Conflict response if there are exceptions to load at least one resource
11261126
in the Chromium.
11271127

11281128
```php

docs/screenshot/customization.md

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,37 @@
33
## Available functions
44

55
### Render
6-
[width](#width)
7-
[height](#height)
8-
[clip](#clip)
9-
[quality](#quality)
10-
[omitBackground](#omitBackground)
6+
[width](#width)
7+
[height](#height)
8+
[clip](#clip)
9+
[quality](#quality)
10+
[omitBackground](#omitBackground)
1111

1212
### Additional content
1313
[download from](#download-from)
1414

1515
### Style
16-
[assets](../assets.md)
16+
[assets](../assets.md)
1717
[addAsset](../assets.md)
1818

1919
### Request
2020
[optimizeForSpeed](#optimizeForSpeed)
21-
[waitDelay](#waitDelay)
22-
[waitForExpression](#waitForExpression)
23-
[emulatedMediaType](#emulatedMediaType)
24-
[cookies](#cookies)
25-
[setCookie](#setCookie)
26-
[addCookies](#addCookies)
27-
[forwardCookie](#forwardCookie)
28-
[forwardAuthentication](#forwardAuthentication)
29-
[asUser](#asUser)
30-
[userAgent](#userAgent)
31-
[extraHttpHeaders](#extraHttpHeaders)
32-
[addExtraHttpHeaders](#addExtraHttpHeaders)
33-
[failOnHttpStatusCodes](#failOnHttpStatusCodes)
34-
[failOnResourceHttpStatusCodes](#failOnResourceHttpStatusCodes)
35-
[failOnResourceLoadingFailed](#failOnResourceLoadingFailed)
36-
[failOnConsoleExceptions](#failOnConsoleExceptions)
21+
[waitDelay](#waitDelay)
22+
[waitForExpression](#waitForExpression)
23+
[emulatedMediaType](#emulatedMediaType)
24+
[cookies](#cookies)
25+
[setCookie](#setCookie)
26+
[addCookies](#addCookies)
27+
[forwardCookie](#forwardCookie)
28+
[forwardAuthentication](#forwardAuthentication)
29+
[asUser](#asUser)
30+
[userAgent](#userAgent)
31+
[extraHttpHeaders](#extraHttpHeaders)
32+
[addExtraHttpHeaders](#addExtraHttpHeaders)
33+
[failOnHttpStatusCodes](#failOnHttpStatusCodes)
34+
[failOnResourceHttpStatusCodes](#failOnResourceHttpStatusCodes)
35+
[failOnResourceLoadingFailed](#failOnResourceLoadingFailed)
36+
[failOnConsoleExceptions](#failOnConsoleExceptions)
3737
[skipNetworkIdleEvent](#skipNetworkIdleEvent)
3838

3939
### Formatting
@@ -194,7 +194,7 @@ class YourController
194194

195195
### download from
196196

197-
> [!WARNING]
197+
> [!WARNING]
198198
> URL of the file. It MUST return a `Content-Disposition` header with a filename parameter.
199199
200200
To download files resource from URLs.
@@ -348,6 +348,9 @@ class YourController
348348
{
349349
return $gotenberg
350350
->html()
351+
->content('twig_simple_pdf.html.twig', [
352+
'my_var' => 'value'
353+
])
351354
->emulatedMediaType(EmulatedMediaType::Screen)
352355
->generate()
353356
->stream()
@@ -375,6 +378,9 @@ class YourController
375378
{
376379
return $gotenberg
377380
->html()
381+
->content('twig_simple_pdf.html.twig', [
382+
'my_var' => 'value'
383+
])
378384
->cookies([[
379385
'name' => 'my_cookie',
380386
'value' => 'symfony',

src/Builder/Behaviors/Chromium/CookieTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function asUser(UserInterface $user, string $firewallName = 'main'): stat
148148
return $this->setCookie($request->getSession()->getName(), [
149149
'name' => $request->getSession()->getName(),
150150
'value' => $request->getSession()->getId(),
151-
'domain' => $this->getRequestContext()?->getHost(),
151+
'domain' => $this->getRequestContext()?->getHost() ?? $request->getHost(),
152152
]);
153153
}
154154

tests/Builder/Behaviors/Chromium/CookieTestCaseTrait.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Symfony\Component\HttpFoundation\Request;
1111
use Symfony\Component\HttpFoundation\RequestStack;
1212
use Symfony\Component\HttpFoundation\Session\Session;
13-
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1413

1514
/**
1615
* @template T of BuilderInterface

tests/Fixtures/Entity/FakeUser.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,4 @@ public function getUserIdentifier(): string
2121
{
2222
return 'John Doe';
2323
}
24-
25-
public function __serialize():array
26-
{
27-
return [];
28-
}
2924
}

0 commit comments

Comments
 (0)