{"id":13705209,"url":"https://github.com/sanzstez/gotenberg-ruby","last_synced_at":"2025-05-05T16:31:40.625Z","repository":{"id":59921738,"uuid":"535571664","full_name":"sanzstez/gotenberg-ruby","owner":"sanzstez","description":"A gem that provides a client interface for the Gotenberg PDF generate service","archived":false,"fork":false,"pushed_at":"2024-01-26T09:29:05.000Z","size":98,"stargazers_count":32,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T17:50:37.200Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/sanzstez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-12T08:18:37.000Z","updated_at":"2025-03-26T00:49:08.000Z","dependencies_parsed_at":"2023-11-24T15:43:13.792Z","dependency_job_id":null,"html_url":"https://github.com/sanzstez/gotenberg-ruby","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"fada0c3a3202451a0e4c5e70608445613d906999"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanzstez%2Fgotenberg-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanzstez%2Fgotenberg-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanzstez%2Fgotenberg-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanzstez%2Fgotenberg-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanzstez","download_url":"https://codeload.github.com/sanzstez/gotenberg-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252533853,"owners_count":21763666,"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":[],"created_at":"2024-08-02T22:00:35.444Z","updated_at":"2025-05-05T16:31:40.355Z","avatar_url":"https://github.com/sanzstez.png","language":"Ruby","funding_links":[],"categories":["Ruby","Clients"],"sub_categories":[],"readme":"This package is a Ruby client for [Gotenberg](https://gotenberg.dev), a developer-friendly API to interact with powerful \ntools like Chromium and LibreOffice for converting numerous document formats (HTML, Markdown, Word, Excel, etc.) into \nPDF files, and more!\n\n## Requirement\n\nThis packages requires [Gotenberg](https://gotenberg.dev), a Docker-powered stateless API for PDF files:\n\n* 🔥 [Live Demo](https://gotenberg.dev/docs/get-started/live-demo)\n* [Docker](https://gotenberg.dev/docs/get-started/docker)\n* [Docker Compose](https://gotenberg.dev/docs/get-started/docker-compose)\n* [Kubernetes](https://gotenberg.dev/docs/get-started/kubernetes)\n* [Cloud Run](https://gotenberg.dev/docs/get-started/cloud-run)\n\n## Installation\n\n```ruby\ngem \"gotenberg-ruby\"\n```\n\n## Usage\n\n* [Send a request to the API](#send-a-request-to-the-api)\n* [Chromium](#chromium)\n* [LibreOffice](#libreOffice)\n* [PDF Engines](#pdf-engines)\n* [Webhook](#webhook)\n* [Exiftools](#exiftools)\n\n### Run Gotenberg\n\nRun microservice with docker-compose:\n\n```\nversion: \"3\"\n\nservices:\n  gotenberg:\n    image: gotenberg/gotenberg:8\n    restart: always\n    ports:\n      - 3000:3000\n```\n\n### Send a request to the API\n\nAfter having created the HTTP request (see below), you have two options:\n\n1. Get the response from the API and handle it according to your need.\n2. Save the resulting file to a given directory.\n\n\u003e In the following examples, we assume the Gotenberg API is available at http://localhost:3000.\n\n### Chromium\n\nThe [Chromium module](https://gotenberg.dev/docs/modules/chromium) interacts with the Chromium browser to convert HTML documents to PDF.\n\n#### Convert a target URL to PDF\n\nSee https://gotenberg.dev/docs/modules/chromium#url.\n\nConverting a target URL to PDF is as simple as:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\nend\n```\n\n#### Usage:\n\n```ruby\n# generate pdf output binary data or raise method exception\npdf = document.to_binary\n\n# safe check if pdf generate is success\nsuccess = document.success?\n\n# fetch exception data\nerror_message = document.exception.message\n\n# save PDF file\nFile.open('filename.pdf', 'wb') do |file|\n  file \u003c\u003c document.to_binary\nend\n```\n\nPass additional headers for faraday client instance (Authorization, User-Agent, etc.):\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL'], headers: { 'Authorization': 'Bearer token123' }) do |doc|\n  doc.url 'https://my.url'\nend\n```\n\nAvailable exceptions:\n\n```ruby\n# raise while PDF transform failed\nGotenberg::TransformError\n\n# raise while change PDF metadata failed\nGotenberg::ModifyMetadataError\n\n# raise while loading asset source failed\nGotenberg::RemoteSourceError\n```\n\nYou may inject `\u003clink\u003e` and `\u003cscript\u003e` HTML elements thanks to the `extra_link_tags` and `extra_script_tags` arguments:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url', ['https://my.css'], ['https://my.js']\nend\n```\n\nPlease note that Gotenberg will add the `\u003clink\u003e` and `\u003cscript\u003e` elements based on the order of the arguments.\n\n#### Rails integrations\n\nFor rails apps gem provide few helpful helpers for easier access to assets inside your rails app:\n\n```ruby\n# read from assets pipeline or webpacker\ngotenberg_image_tag 'logo.svg'\n\n# read from absolute file path (use with carefully for security reasons)\ngotenberg_image_tag 'app/assets/images/logo.svg', absolute_path: true\n\n# also you can encode you source as base64 data resource (useful for header and footer)\ngotenberg_image_tag 'app/assets/images/logo.svg', absolute_path: true, inline: true\n\n# same methods available for js\ngotenberg_javascript_tag 'application.js', inline: true\n\n# ... and css. \ngotenberg_stylesheet_tag 'application.css', inline: true\n```\n\n⚠️ Gem also supported extracting CSS nested resources defined with url() in experimentally mode.\n\n```ruby\n# skip nested resources auto extracting\ngotenberg_stylesheet_tag 'application.css', inline: true, skip_analyze: true\n```\n\n#### Convert an HTML document to PDF\n\nSee https://gotenberg.dev/docs/modules/chromium#html.\n\nPrepare HTML content with build-in Rails methods:\n\n```ruby\n# declare HTML renderer\nrenderer = ApplicationController.renderer.new(https: true, http_host: 'localhost:3000')\n\n# render HTML string for passing into service\nindex_html = renderer.render 'pdf/document', layout: 'pdf', locals: {}\n```\n\nYou may convert an HTML document string with:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\nend\n```\n\nYou may also send additional files, like images, fonts, stylesheets, and so on. The only requirement is that their paths\nin the HTML DOM are on the root level.\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.assets '/path/to/my.css', '/path/to/my.js', ['\u003cbinary string\u003e', 'my.png']\nend\n```\n\n#### Change PDF meta with exiftools\n\nIf you want to use this feature, you need to install additional package to host system:\n\n```\nsudo apt install exiftool\n```\n\n and now you can change PDF metatags using exiftools:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.meta title: 'Custom PDF title'\nend\n```\n\nNote: for Rails based apps, you can setup \u003ctitle\u003eCustom PDF title\u003c/title\u003e header in index.html and\nit will be automatically added to output PDF.\n\n#### Configuration file (optionally)\n\n```ruby\nGotenberg.configure do |config|\n  # activate HTML debug mode\n  config.html_debug = false\n\n  # default temporary directory for output\n  config.backtrace_dir = Rails.root.join('tmp', 'gotenberg')\nend\n```\n\n#### Convert one or more markdown files to PDF\n\nSee https://gotenberg.dev/docs/modules/chromium#markdown.\n\nYou may convert markdown files with:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.markdown wrapper_html, '/path/to/file.md'\nend\n```\n\nOr with raw input:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.markdown wrapper_html, ['\u003cbinary data\u003e', 'file.md']\nend\n```\n\nThe first argument is a `Stream` with HTML content, for instance:\n\n```html\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"utf-8\"\u003e\n    \u003ctitle\u003eMy PDF\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    {{ toHTML \"file.md\" }}\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nHere, there is a Go template function `toHTML`. Gotenberg will use it to convert a markdown file's content to HTML.\n\nLike the HTML conversion, you may also send additional files, like images, fonts, stylesheets, and so on. The only \nrequirement is that their paths in the HTML DOM are on the root level.\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.markdown wrapper_html, '/path/to/file.md'\n  doc.assets '/path/to/my.css', '/path/to/my.js', '/path/to/my2.md', ['\u003cbinary data\u003e', 'file_2.md']\nend\n```\n\n#### Paper size\n\nYou may override the default paper size with:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.paper_size width, height\nend\n```\n\nExamples of paper size (width x height, in inches):\n\n* `Letter` - 8.5 x 11 (default)\n* `Legal` - 8.5 x 14\n* `Tabloid` - 11 x 17\n* `Ledger` - 17 x 11\n* `A0` - 33.1 x 46.8\n* `A1` - 23.4 x 33.1\n* `A2` - 16.54 x 23.4\n* `A3` - 11.7 x 16.54\n* `A4` - 8.27 x 11.7\n* `A5` - 5.83 x 8.27\n* `A6` - 4.13 x 5.83\n\n#### Margins\n\nYou may override the default margins (i.e., `0.39`, in inches):\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.margins top: 1, bottom: 1, left: 0.39, right: 0.39\nend\n```\n\n#### Prefer CSS page size\n\nYou may force page size as defined by CSS:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.prefer_css_page_size\nend\n```\n\n#### Print the background graphics\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.print_background\nend\n```\n\n#### Landscape orientation\n\nYou may override the default portrait orientation with:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.landscape\nend\n```\n\n#### Scale\n\nYou may override the default scale of the page rendering (i.e., `1.0`) with:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.scale 2\nend\n```\n\n#### Page ranges\n\nYou may set the page ranges to print, e.g., `1-5, 8, 11-13`. Empty means all pages.\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.native_page_ranges '1-2'\nend\n```\n\n#### Header and footer\n\nYou may add a header and/or a footer to each page of the PDF:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.header header_html\n  doc.html index_html\n  doc.footer footer_html\n  doc.margins top: 1, bottom: 1\nend\n```\n\nEach of them has to be a complete HTML document:\n\n```html\n\u003chtml\u003e\n\u003chead\u003e\n    \u003cstyle\u003e\n    body {\n        font-size: 8rem;\n        margin: 4rem auto;\n    }\n    \u003c/style\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cp\u003e\u003cspan class=\"pageNumber\"\u003e\u003c/span\u003e of \u003cspan class=\"totalPages\"\u003e\u003c/span\u003e\u003c/p\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nThe following classes allow you to inject printing values:\n\n* `date` - formatted print date.\n* `title` - document title.\n* `url` - document location.\n* `pageNumber` - current page number.\n* `totalPages` - total pages in the document.\n\n⚠️ Make sure that:\n\n1. Margins top and bottom are large enough (i.e., `margins(top: 1, bottom: 1, left: 0.39, right: 0.39)`)\n2. The font size is big enough.\n\n⚠️ There are some limitations:\n\n* No JavaScript.\n* The CSS properties are independent of the ones from the HTML document.\n* The footer CSS properties override the ones from the header;\n* Only fonts installed in the Docker image are loaded - see the [Fonts chapter](https://gotenberg.dev/docs/configuration#fonts).\n* Images only work using a base64 encoded source - i.e., `data:image/png;base64, iVBORw0K....`\n* `background-color` and color `CSS` properties require an additional `-webkit-print-color-adjust: exact` CSS property in order to work.\n* Assets are not loaded (i.e., CSS files, scripts, fonts, etc.).\n\n#### Wait delay\n\nWhen the page relies on JavaScript for rendering, and you don't have access to the page's code, you may want to wait a\ncertain amount of time (i.e., `1s`, `2ms`, etc.) to make sure Chromium has fully rendered the page you're trying to generate.\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.wait_delay '3s'\nend\n```\n\n#### Wait for expression\n\nYou may also wait until a given JavaScript expression returns true:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.wait_for_expression \"window.status === 'ready'\"\nend\n```\n\n#### User agent\n\nYou may override the default `User-Agent` header used by Gotenberg:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.html index_html\n  doc.user_agent(\"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0\")\nend\n```\n\n#### Extra HTTP headers\n\nYou may add HTTP headers that Chromium will send when loading the HTML document:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.extra_http_headers({'My-Header-1' =\u003e 'My value', 'My-Header-2' =\u003e 'My value'})\nend\n```\n\n#### Client Extra HTTP headers\n\nThis method just duplicate way of passing headers into faraday client. Have same purpose:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.client_extra_http_headers({ 'Authorization': 'Bearer token123' })\nend\n```\n\n#### Fail on console exceptions\n\nYou may force Gotenberg to return a `409 Conflict` response if there are exceptions in the Chromium console:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.fail_on_console_exceptions\nend\n```\n\n#### Emulate media type\n\nSome websites have dedicated CSS rules for print. Using `screen` allows you to force the \"standard\" CSS rules.\nYou may also force the `print` media type:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.emulate_media_type 'screen'\nend\n```\n\n#### PDF Format\n\nSee https://gotenberg.dev/docs/modules/pdf-engines#engines.\n\nYou may set the PDF format of the resulting PDF with:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.pdf_format 'PDF/A-1a'\nend\n```\n\n### LibreOffice\n\nThe [LibreOffice module](https://gotenberg.dev/docs/modules/libreoffice) interacts with [LibreOffice](https://www.libreoffice.org/) \nto convert documents to PDF, thanks to [unoconv](https://github.com/unoconv/unoconv).\n\n#### Convert documents to PDF\n\nSee https://gotenberg.dev/docs/modules/libreoffice#route.\n\nConverting a document to PDF is as simple as:\n\n```ruby\ndocument = Gotenberg::Libreoffice.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.convert '/path/to/my.docx'\nend\n```\n\nIf you send many documents, Gotenberg will return a ZIP archive with the PDFs:\n\n```ruby\ndocument = Gotenberg::Libreoffice.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.convert '/path/to/my.docx', '/path/to/my.xlsx', ['\u003cbinary data\u003e', 'some.odt']\nend\n\n# will return binary data with zip archive content\nFile.open('archive.zip', 'wb') do |file|\n  file \u003c\u003c document.to_binary\nend\n```\n\nYou may also merge them into one unique PDF:\n\n```ruby\ndocument = Gotenberg::Libreoffice.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.merge\n  doc.convert '/path/to/my.docx', '/path/to/my.xlsx', ['\u003cbinary data\u003e', 'some.odt']\nend\n```\n\nPlease note that the merging order is determined by the order of the arguments.\n\n#### Landscape orientation\n\nYou may override the default portrait orientation with:\n\n```ruby\ndocument = Gotenberg::Libreoffice.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.landscape\n  doc.convert '/path/to/my.docx'\nend\n```\n\n#### Page ranges\n\nYou may set the page ranges to print, e.g., `1-4`. Empty means all pages.\n\n```ruby\ndocument = Gotenberg::Libreoffice.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.native_page_ranges '1-2'\n  doc.convert '/path/to/my.docx'\nend\n```\n\n⚠️ The page ranges are applied to all files independently.\n\n#### PDF format\n\nSee https://gotenberg.dev/docs/modules/pdf-engines#engines.\n\nYou may set the PDF format of the resulting PDF(s) with:\n\n```ruby\ndocument = Gotenberg::Libreoffice.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.pdf_format 'PDF/A-1a'\n  doc.convert '/path/to/my.docx'\nend\n```\n\nYou may also explicitly tell Gotenberg to use [unoconv](https://github.com/unoconv/unoconv) to convert the resulting PDF(s) to a PDF format:\n\n```ruby\ndocument = Gotenberg::Libreoffice.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.native_pdf_format 'PDF/A-1a'\n  doc.convert '/path/to/my.docx'\nend\n```\n\n⚠️ You cannot set both property, otherwise Gotenberg will return `400 Bad Request` response.\n\n\n### PDF Engines\n\nThe [PDF Engines module](https://gotenberg.dev/docs/modules/pdf-engines) gathers all engines that can manipulate PDF files.\n\n#### Merge PDFs\n\nSee https://gotenberg.dev/docs/modules/pdf-engines#merge.\n\nMerging PDFs is as simple as:\n\n```ruby\ndocument = Gotenberg::PdfEngines.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.merge '/path/to/my.pdf', '/path/to/my2.pdf', ['\u003cbinary data\u003e', 'some.pdf']\nend\n```\n\nPlease note that the merging order is determined by the order of the arguments.\n\nYou may also set the PDF format of the resulting PDF(s) with:\n\n```ruby\ndocument = Gotenberg::PdfEngines.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.pdf_format 'PDF/A-1a'\n  doc.merge '/path/to/my.pdf', '/path/to/my2.pdf', '/path/to/my3.pdf'\nend\n```\n\n#### Convert to a specific PDF format\n\nSee https://gotenberg.dev/docs/modules/pdf-engines#convert.\n\nYou may convert a PDF to a specific PDF format with:\n\n```ruby\ndocument = Gotenberg::PdfEngines.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.convert '/path/to/my.pdf', format: 'PDF/A-1a'\nend\n```\n\nIf you send many PDFs, Gotenberg will return a ZIP archive with the PDFs:\n\n```ruby\ndocument = Gotenberg::PdfEngines.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.convert '/path/to/my.pdf', '/path/to/my2.pdf', '/path/to/my3.pdf', ['\u003cbinary data\u003e', 'some.pdf'], format: 'PDF/A-1a'\nend\n\n# will return binary data with zip archive content\nFile.open('archive.zip', 'wb') do |file|\n  file \u003c\u003c document.to_binary\nend\n```\n\n### Webhook\n\nThe [Webhook module](https://gotenberg.dev/docs/modules/webhook) is a Gotenberg middleware that sends the API\nresponses to callbacks.\n\n⚠️ You cannot use the `document.to_binary` method if you're using the webhook feature.\n\nFor instance:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.webhook 'https://my.webhook.url', 'https://my.webhook.error.url'\nend\n```\n\nYou may also override the default HTTP method (`POST`) that Gotenberg will use to call the webhooks:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.webhook_method('PATCH')\n  doc.webhook_error_method('PUT')\n  doc.webhook 'https://my.webhook.url', 'https://my.webhook.error.url'\nend\n```\n\nYou may also tell Gotenberg to add extra HTTP headers that it will send alongside the request to the webhooks:\n\n```ruby\ndocument = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|\n  doc.url 'https://my.url'\n  doc.webhook_extra_http_headers({'My-Header-1' =\u003e 'My value', 'My-Header-2' =\u003e 'My value'})\n  doc.webhook 'https://my.webhook.url', 'https://my.webhook.error.url'\nend\n```\n\n### Exiftools\n\nGem also proxify (expert mode) access to mini_exiftools througth *Gotenberg::Exiftools* class.\nYou can change PDF metadata manually:\n\n```ruby\nbinary = Gotenberg::Exiftools.modify(pdf_binary, { title: 'Document 1' })\n\n# save PDF file\nFile.open('filename.pdf', 'wb') do |file|\n  file \u003c\u003c binary\nend\n```\n\n⚠️ Class is just wrapper around *MiniExiftool* class, so you need handle exceptions manually/carefully in begin/rescue block.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanzstez%2Fgotenberg-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanzstez%2Fgotenberg-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanzstez%2Fgotenberg-ruby/lists"}