{"id":14983876,"url":"https://github.com/sensiolabs/gotenbergbundle","last_synced_at":"2026-03-16T23:02:37.123Z","repository":{"id":245306718,"uuid":"728285078","full_name":"sensiolabs/GotenbergBundle","owner":"sensiolabs","description":"A Symfony Bundle for interacting with Gotenberg. Integrates natively with twig, router, PHPStorm and more !","archived":false,"fork":false,"pushed_at":"2025-04-09T15:16:03.000Z","size":617,"stargazers_count":93,"open_issues_count":15,"forks_count":11,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-11T23:45:36.858Z","etag":null,"topics":["csv","gotenberg","html","markdown","office","pdf","pdf-generation","php","screenshot","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sensiolabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-06T16:07:11.000Z","updated_at":"2025-04-09T14:05:43.000Z","dependencies_parsed_at":"2024-06-21T09:24:12.755Z","dependency_job_id":"57e972bc-6894-41d6-8191-243bb8b39576","html_url":"https://github.com/sensiolabs/GotenbergBundle","commit_stats":{"total_commits":65,"total_committers":11,"mean_commits":5.909090909090909,"dds":0.6615384615384615,"last_synced_commit":"61b13e066d953db496bc5c2907da6041427aab91"},"previous_names":["sensiolabs/gotenbergbundle"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensiolabs%2FGotenbergBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensiolabs%2FGotenbergBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensiolabs%2FGotenbergBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensiolabs%2FGotenbergBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sensiolabs","download_url":"https://codeload.github.com/sensiolabs/GotenbergBundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248616098,"owners_count":21134000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","gotenberg","html","markdown","office","pdf","pdf-generation","php","screenshot","symfony","symfony-bundle"],"created_at":"2024-09-24T14:08:06.483Z","updated_at":"2026-03-16T23:02:37.111Z","avatar_url":"https://github.com/sensiolabs.png","language":"PHP","readme":"# Gotenberg Bundle\n\n[![Latest Version](https://img.shields.io/github/release/sensiolabs/GotenbergBundle.svg?style=flat-square)](https://github.com/sensiolabs/GotenbergBundle/releases)\n[![Total Downloads](https://poser.pugx.org/sensiolabs/gotenberg-bundle/downloads)](https://packagist.org/packages/sensiolabs/gotenberg-bundle)\n[![Monthly Downloads](https://poser.pugx.org/sensiolabs/gotenberg-bundle/d/monthly)](https://packagist.org/packages/sensiolabs/gotenberg-bundle)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENCE)\n[![Static analysis](https://github.com/sensiolabs/GotenbergBundle/actions/workflows/static.yml/badge.svg?branch=main)](https://github.com/sensiolabs/GotenbergBundle/actions/workflows/static.yml?query=branch%3Amain)\n[![Tests](https://github.com/sensiolabs/GotenbergBundle/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/sensiolabs/GotenbergBundle/actions/workflows/tests.yml?query=branch%3Amain)\n\n\u003e [!WARNING]  \n\u003e This Bundle is experimental and subject to change in a future release.\n\n## What is it?\n\nThis bundle allows you to generate, stream and save PDF locally from URL, HTML,\nMarkdown or any Office file. Different options are available depending on the source.\n\nIt also helps you to generate, stream and save images locally from URL, HTML and\nMarkdown by taking a screenshot.\n\n## How to install\n\nInstall the bundle using composer:\n\n```bash\ncomposer require sensiolabs/gotenberg-bundle\n```\n\n\u003e [!NOTE]\n\u003e This bundle interacts with [Gotenberg 8.x](https://gotenberg.dev/docs/getting-started/installation) which is used\n\u003e under the hood.\n\n### With Symfony Flex\n\nIf you accept the Symfony Flex recipe during installation:\n* The bundle will be automatically registered. \n* A configuration skeleton file will be created. \n* Docker Compose will be updated with a new gotenberg service. \n* The `.env` file will be updated with a `GOTENBERG_DSN` value pointing to `gotenberg:3000`. You can update this value\n  if your Gotenberg instance is hosted elsewhere.\n\n### Without Symfony Flex\n\n\u003e [!NOTE]\n\u003e You first need to install and configure [Gotenberg 8.x](https://gotenberg.dev/docs/getting-started/installation) by \n\u003e yourself.\n\nManually enable the bundle by adding it to the list of registered bundles in your `config/bundles.php` file:\n\n```php\n// config/bundles.php\n\nreturn [\n    // ...\n    SensioLabs\\GotenbergBundle\\SensioLabsGotenbergBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n## Basic Usage\n\n### PDF\n\nYou can generate a PDF locally from URL, HTML, Markdown or any Office files.\n\n#### URL\n\nAfter injecting ``GotenbergPdfInterface`` you simply need to call the method ``url``,\nwhich will return a ``UrlPdfBuilder`` instance.\n\n``UrlPdfBuilder`` lets you pass the URL of the page you want to convert into PDF\nto the method ``url``.\n\n```php\nnamespace App\\Controller;\n\nuse Sensiolabs\\GotenbergBundle\\GotenbergPdfInterface;\n\nclass YourController\n{\n    public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response\n    {\n        return $gotenberg-\u003eurl()\n            -\u003eurl('https://sensiolabs.com/fr/')\n            -\u003egenerate()\n            -\u003estream() // will return directly a stream response\n        ;\n    }\n}\n```\n\n\u003e [!TIP]\n\u003e For more information go to [Gotenberg documentations](https://gotenberg.dev/docs/routes#url-into-pdf-route).\n\n#### Twig\n\n\u003e [!WARNING]  \n\u003e Every Twig template you pass to Gotenberg must have the following structure.  \n\u003e Even Header or Footer parts.\n\u003e ```html\n\u003e \u003c!DOCTYPE html\u003e\n\u003e \u003chtml lang=\"en\"\u003e\n\u003e     \u003chead\u003e\n\u003e         \u003cmeta charset=\"utf-8\" /\u003e\n\u003e         \u003ctitle\u003eMy PDF\u003c/title\u003e\n\u003e     \u003c/head\u003e\n\u003e     \u003cbody\u003e\n\u003e         \u003c!-- Your code goes here --\u003e\n\u003e     \u003c/body\u003e\n\u003e \u003c/html\u003e\n\u003e ```\n\n```php\nnamespace App\\Controller;\n\nuse Sensiolabs\\GotenbergBundle\\GotenbergPdfInterface;\n\nclass YourController\n{\n    public function yourControllerMethod(GotenbergPdfInterface $gotenberg): Response\n    {\n        return $gotenberg-\u003ehtml()\n            -\u003econtent('twig_simple_pdf.html.twig', [\n                'my_var' =\u003e 'value'\n            ])\n            -\u003egenerate()\n            -\u003estream() // will return directly a stream response\n        ;\n    }\n}\n```\n\nIf a template needs to link to a static asset (e.g. an image), this bundle\nprovides a `{{ gotenberg_asset() }}` Twig function to generate the correct\npath AND add it to the builder automatically.\n\nThis function work as [asset() Twig function](https://symfony.com/doc/current/templates.html#linking-to-css-javascript-and-image-assets) \nand fetch your assets in the `assets` folder of your application.\nIf your files are in another folder, you can override the default value of ``assets_directory``\nin your configuration file ``config/sensiolabs_gotenberg.yml``. The path provided\ncan be relative as well as absolute.\n\n```twig\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"utf-8\"/\u003e\n    \u003ctitle\u003ePDF body\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003cmain\u003e\n        \u003ch1\u003eHello world!\u003c/h1\u003e\n        \u003cimg src=\"{{ gotenberg_asset('public/img/ceo.jpeg') }}\" alt=\"CEO\"/\u003e\n        \u003cimg src=\"{{ gotenberg_asset('public/img/admin.jpeg') }}\" alt=\"Admin\"/\u003e\n    \u003c/main\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\u003e [!TIP]\n\u003e For more information go to [Gotenberg documentations](https://gotenberg.dev/docs/routes#html-file-into-pdf-route).\n\n### Screenshot\n\nYou can generate a screenshot locally from URL, HTML and Markdown.\n\n#### URL\n\nAfter injecting ``GotenbergScreenshotInterface`` you simply need to call the\nmethod ``url``, which will return a ``UrlScreenshotBuilder`` instance.\n\n``UrlScreenshotBuilder`` lets you pass the URL of the page you want to convert\ninto screenshot to the method ``url``.\n\n```php\nnamespace App\\Controller;\n\nuse Sensiolabs\\GotenbergBundle\\GotenbergScreenshotInterface;\n\nclass YourController\n{\n    public function yourControllerMethod(GotenbergScreenshotInterface $gotenberg): Response\n    {\n        return $gotenberg-\u003eurl()\n             -\u003eurl('https://sensiolabs.com/fr/')\n             -\u003egenerate()\n             -\u003estream()\n        ;\n    }\n}\n```\n#### Twig\n\nAfter injecting ``GotenbergScreenshotInterface`` you simply need to call the method\n``html``, which will return a ``HtmlScreenshotBuilder`` instance.\n\n``HtmlScreenshotBuilder`` lets you pass the content of the page you want to convert\ninto screenshot to the method ``content``.\n\n```php\nnamespace App\\Controller;\n\nuse Sensiolabs\\GotenbergBundle\\GotenbergScreenshotInterface;\n\nclass YourController\n{\n    public function yourControllerMethod(GotenbergScreenshotInterface $gotenberg): Response\n    {\n        return $gotenberg-\u003ehtml()\n            -\u003econtent('twig_simple_pdf.html.twig', [\n                 'my_var' =\u003e 'value'\n            ])\n            -\u003egenerate()\n            -\u003estream()\n        ;\n    }\n}\n```\n\n\u003e [!TIP]\n\u003e For more information go to [Gotenberg documentations](https://gotenberg.dev/docs/routes#screenshots-route).\n\n### Advanced Usage\n\n1. [Configuration](./docs/configuration.md)\n2. [Processing (saving for example)](./docs/processing.md)\n3. [Working with assets](./docs/assets.md)\n4. [Builders API](./docs/builders_api.md)\n5. [Async \u0026 Webhooks](./docs/webhook.md)\n6. [Working with fonts](./docs/fonts.md)\n\n#### PDF\n\n1. [Add header / footer](./docs/pdf/header-footer.md)\n2. [HTML Builder](./docs/pdf/html-builder.md)\n3. [Markdown Builder](./docs/pdf/markdown-builder.md)\n4. [Url Builder](./docs/pdf/url-builder.md)\n5. [Office Builder](./docs/pdf/office-builder.md) (available extensions for conversion below)  \n    `123`, `602`, `abw`, `bib`, `bmp`, `cdr`, `cgm`, `cmx`, `csv`, `cwk`, `dbf`, `dif`, `doc`, `docm`,\n    `docx`, `dot`, `dotm`, `dotx`, `dxf`, `emf`, `eps`, `epub`, `fodg`, `fodp`, `fods`, `fodt`, `fopd`,\n    `gif`, `htm`, `html`, `hwp`, `jpeg`, `jpg`, `key`, `ltx`, `lwp`, `mcw`, `met`, `mml`, `mw`, `numbers`,\n    `odd`, `odg`, `odm`, `odp`, `ods`, `odt`, `otg`, `oth`, `otp`, `ots`, `ott`, `pages`, `pbm`, `pcd`,\n    `pct`, `pcx`, `pdb`, `pdf`, `pgm`, `png`, `pot`, `potm`, `potx`, `ppm`, `pps`, `ppt`, `pptm`, `pptx`,\n    `psd`, `psw`, `pub`, `pwp`, `pxl`, `ras`, `rtf`, `sda`, `sdc`, `sdd`, `sdp`, `sdw`, `sgl`, `slk`,\n    `smf`, `stc`, `std`, `sti`, `stw`, `svg`, `svm`, `swf`, `sxc`, `sxd`, `sxg`, `sxi`, `sxm`, `sxw`,\n    `tga`, `tif`, `tiff`, `txt`, `uof`, `uop`, `uos`, `uot`, `vdx`, `vor`, `vsd`, `vsdm`, `vsdx`, `wb2`,\n    `wk1`, `wks`, `wmf`, `wpd`, `wpg`, `wps`, `xbm`, `xhtml`, `xls`, `xlsb`, `xlsm`, `xlsx`, `xlt`, `xltm`,\n    `xltx`, `xlw`, `xml`, `xpm`, `zabw`\n6. [Merge Builder](./docs/pdf/merge-builder.md)\n7. [Convert Builder](./docs/pdf/convert-builder.md)\n8. [Split Builder](./docs/pdf/split-builder.md)\n9. [PDF customization](./docs/pdf/customization.md) (available for every builder except LibreOffice, Merge and Split)\n\n#### Screenshot\n\n1. [HTML Builder](./docs/screenshot/html-builder.md)\n2. [Markdown Builder](./docs/screenshot/markdown-builder.md)\n3. [Url Builder](./docs/screenshot/url-builder.md)\n4. [Screenshot customization](./docs/screenshot/customization.md)\n\n### Profiler\n\nComes with a built-in profiler panel to help you during your development.\n\n## Credits\n\nThis bundle was inspired by [Gotenberg PHP](https://github.com/gotenberg/gotenberg-php).\n- [Steven RENAUX](https://github.com/StevenRenaux)\n- [Adrien ROCHES](https://github.com/Neirda24)\n- [Hubert LENOIR](https://github.com/Jean-Beru)\n- [All Contributors](../../contributors)\n\n## Licence\n\nMIT License (MIT): see the [License File](LICENSE) for more details.\n\n## FAQ\n\n\u003cdetails\u003e\n    \u003csummary\u003eMy PDF / Screenshot is blank but I have no errors!\u003c/summary\u003e\n    It may be because Gotenberg is trying to access an invalid URL (when using the\n    `-\u003eurl()` or `-\u003eroute()` modes).\n    For example if Gotenberg tries to access a page on `https://localhost:8001` but\n    the SSL is a local provided one. Then Chromium won't be able to authorize access\n    to the website. To fix this you can update your Gotenberg Docker service as followed:\n\n    ```diff\n    --- a/compose.yaml\n    +++ b/compose.yaml\n    @@ -1,6 +1,9 @@\n    services:\n         gotenberg:\n             image: 'gotenberg/gotenberg:8'\n    +         command:\n    +             - 'gotenberg'\n    +             - '--chromium-ignore-certificate-errors'\n    ```\n\n    It can also be because from Gotenberg \u003cabbr title=\"Point of View\"\u003ePoV\u003c/abbr\u003e the \n    URL of your Symfony app is not reachable.\n    Let's say you are using [symfony CLI](https://symfony.com/download) to run your\n    project locally with Gotenberg running in Docker. You need to configure the \n    `request_context` like so:\n\n    ```diff\n    --- a/config/packages/gotenberg.yaml\n    +++ b/config/packages/gotenberg.yaml\n    @@ -6,5 +6,5 @@ framework:\n     \n    sensiolabs_gotenberg:\n        http_client: 'gotenberg.client'\n    +       request_context:\n    +       base_uri: 'http://host.docker.internal:8000' # 8000 is the port Symfony CLI is running my app on.\n    ```\n\u003c/details\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensiolabs%2Fgotenbergbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensiolabs%2Fgotenbergbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensiolabs%2Fgotenbergbundle/lists"}