Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Beru committed Jul 12, 2024
1 parent 4336d35 commit fada934
Show file tree
Hide file tree
Showing 21 changed files with 119 additions and 33 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class YourController
{
return $gotenberg->url()
->url('https://sensiolabs.com/fr/')
->generate()
->build()
->stream() // will return directly a stream response
;
}
Expand Down Expand Up @@ -108,7 +108,7 @@ class YourController
->content('twig_simple_pdf.html.twig', [
'my_var' => 'value'
])
->generate()
->build()
->stream() // will return directly a stream response
;
}
Expand Down Expand Up @@ -167,7 +167,7 @@ class YourController
{
return $gotenberg->url()
->url('https://sensiolabs.com/fr/')
->generate()
->build()
->stream()
;
}
Expand All @@ -194,7 +194,7 @@ class YourController
->content('twig_simple_pdf.html.twig', [
'my_var' => 'value'
])
->generate()
->build()
->stream()
;
}
Expand Down
33 changes: 16 additions & 17 deletions docs/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ You can add assets in several ways, and it's available for most builders.
> As a reminder, we can only load assets in the content. And not in Header or Footer.
> For more information about [Header and Footer restriction](https://gotenberg.dev/docs/routes#header-footer-chromium)
>
> By default the assets are fetch in the `assets` folder of your application.
> By default, the assets are fetch in the `assets` folder of your application.
> If your assets files are in another folder, you can override the
> default value of `assets_directory` in your configuration file
> `config/sensiolabs_gotenberg.yml`.
>
> The asset path resolution depends on certain criteria:
> - If an absolute path is provided in `{{ gotenberg_asset() }}`, `assets()`
> or `addAsset`, this path will be applied and not the one in the configuration file.
> or `addAsset`, this path will be applied and not the one in the configuration file.
>
> - If a path is provided in `{{ gotenberg_asset() }}`, `assets()`
> or `addAsset`, it will be treated as a relative path from the `assets_directory` configuration.
> or `addAsset`, it will be treated as a relative path from the `assets_directory` configuration.
>
> - If an absolute path is provided in the configuration file (`assets_directory`), the path applied
> in `{{ gotenberg_asset() }}`, `assets()` or `addAsset` will have `assets_directory` as base path.
> in `{{ gotenberg_asset() }}`, `assets()` or `addAsset` will have `assets_directory` as base path.
>
> - If a relative path is provided in the configuration file (`assets_directory`), the path applied
> will have the root of the project as base path followed by the path from the configuration file.
> will have the root of the project as base path followed by the path from the configuration file.
>
> <details>
> <summary>Examples</summary>
Expand All @@ -49,8 +49,7 @@ You can add assets in several ways, and it's available for most builders.
## Twig file
->build()
->streamResponse()n asset path.
`{{ gotenberg_asset() }}` Twig function will help you to generate an asset path.
This function work as [asset() Twig function](https://symfony.com/doc/current/templates.html#linking-to-css-javascript-and-image-assets).
You can provide an absolute path.
Expand Down Expand Up @@ -97,9 +96,9 @@ class YourController
public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response
{
return $gotenberg->html()
->content('t
->build()
->streamResponse()
->content('twig_simple_pdf.html.twig')
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -143,8 +142,8 @@ class YourController
'img/ceo.jpeg',
'img/admin.jpeg'
)
->build()
->streamResponse()
->generate()
->stream()
;
}
}
Expand All @@ -167,8 +166,8 @@ class YourController
'../img/ceo.jpeg',
'../img/admin.jpeg'
)
->build()
->streamResponse()
->generate()
->stream()
;
}
}
Expand All @@ -192,9 +191,9 @@ class YourController
'../img/ceo.jpeg',
'../img/admin.jpeg'
)
->addAsset('
->build()
->streamResponse()
->addAsset('../img/developer.jpeg')
->generate()
->stream()
;
}
}
Expand Down
3 changes: 3 additions & 0 deletions docs/pdf/convert-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class YourController
'document_2.pdf',
)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -59,6 +60,7 @@ class YourController
)
->pdfFormat(PdfFormat::Pdf1b)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -86,6 +88,7 @@ class YourController
)
->pdfUniversalAccess() // is same as `->pdfUniversalAccess(true)`
->generate()
->stream()
;
}
}
Expand Down
30 changes: 30 additions & 0 deletions docs/pdf/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class YourController
])
->paperSize(21, 29.7, Unit::Centimeters)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -103,6 +104,7 @@ class YourController
])
->paperStandardSize(PaperSize::A4)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -155,6 +157,7 @@ class YourController
])
->paperWidth(15, Unit::Inches)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -186,6 +189,7 @@ class YourController
])
->paperHeight(15, Unit::Inches)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -218,6 +222,7 @@ class YourController
])
->margins(1, 2, 3, 4, Unit::Inches)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -245,6 +250,7 @@ class YourController
->marginLeft(4, Unit::Picas)
->marginRight(4, Unit::Millimeters)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -274,6 +280,7 @@ class YourController
])
->preferCssPageSize()
->generate()
->stream()
;
}
}
Expand All @@ -300,6 +307,7 @@ class YourController
])
->printBackground()
->generate()
->stream()
;
}
}
Expand All @@ -326,6 +334,7 @@ class YourController
])
->omitBackground()
->generate()
->stream()
;
}
}
Expand All @@ -352,6 +361,7 @@ class YourController
])
->landscape()
->generate()
->stream()
;
}
}
Expand All @@ -378,6 +388,7 @@ class YourController
])
->scale(2.5)
->generate()
->stream()
;
}
}
Expand All @@ -404,6 +415,7 @@ class YourController
])
->nativePageRanges('1-5')
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -455,6 +467,7 @@ class YourController
'my_var' => 'value'
])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -483,6 +496,7 @@ class YourController
->contentFile('content.html')
->footerFile('footer.html')
->generate()
->stream()
;
}
}
Expand All @@ -505,6 +519,7 @@ class YourController
->contentFile('../templates/html/content.html')
->footerFile('../templates/html/footer.html')
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -537,6 +552,7 @@ class YourController
])
->waitDelay('5s')
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -565,6 +581,7 @@ class YourController
])
->waitForExpression("window.globalVar === 'ready'")
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -597,6 +614,7 @@ class YourController
])
->emulatedMediaType(EmulatedMediaType::Screen)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -633,6 +651,7 @@ class YourController
'sameSite' => 'Lax',
]])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -669,6 +688,7 @@ class YourController
'sameSite' => 'Lax',
])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -702,6 +722,7 @@ class YourController
'sameSite' => 'Lax',
]])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -731,6 +752,7 @@ class YourController
'MyHeader' => 'MyValue'
])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -764,6 +786,7 @@ class YourController
'MyHeader' => 'MyValue'
])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -792,6 +815,7 @@ class YourController
])
->failOnHttpStatusCodes([401, 403])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -823,6 +847,7 @@ class YourController
])
->failOnConsoleExceptions()
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -856,6 +881,7 @@ class YourController
])
->skipNetworkIdleEvent()
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -888,6 +914,7 @@ class YourController
])
->metadata(['Author' => 'SensioLabs', 'Subject' => 'Gotenberg'])
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -918,6 +945,7 @@ class YourController
])
->addMetadata('key', 'value')
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -948,6 +976,7 @@ class YourController
])
->pdfFormat(PdfFormat::Pdf1b)
->generate()
->stream()
;
}
}
Expand Down Expand Up @@ -978,6 +1007,7 @@ class YourController
])
->pdfUniversalAccess()
->generate()
->stream()
;
}
}
Expand Down
Loading

0 comments on commit fada934

Please sign in to comment.