Skip to content

Implemented Routes

Chromium

Access to the Chromium module of Gotenberg, as documented here.

URL into PDF

Gotenberg Link Route Access Required Properties Optional Properties
Documentation chromium.url_to_pdf
  • .url("http://localhost:8888")
See common Chromium options

HTML file into PDF

Gotenberg Link Route Access Required Properties Optional Properties
Documentation chromium.html_to_pdf
  • .index("index.html")

Markdown file(s) into PDF

Gotenberg Link Route Access Required Properties Optional Properties
Documentation chromium.markdown_to_pdf
  • .index("index.html")
  • .markdown_file or markdown_files

Screenshots

Chromium Common Options

Page Properties

Gotenberg Option Route Configuration Python Type Notes
singlePage .single_page() bool Set via keyword only
  • paperWidth
  • paperHeight
.size() PageSize Current only allows size configuration in inches
  • marginTop
  • marginBottom
  • marginLeft
  • marginRight
.margin() PageMarginsType
preferCssPageSize
  • prefer_css_page_size()
  • prefer_set_page_size()
N/A
printBackground
  • background_graphics()
  • no_background_graphics()
N/A
omitBackground
  • hide_background()
  • show_background()
N/A
landscape .orient() PageOrientation
scale scale() int | float
nativePageRanges page_ranges() str
Gotenberg Option Route Configuration Python Type Notes
header.html .header() Path
footer.html .footer() Path

Render Control

Gotenberg Option Route Configuration Python Type Notes
waitDelay .render_wait() int | float
waitForExpression .render_expr() str

Emulated Media Type

Gotenberg Option Route Configuration Python Type Notes
emulatedMediaType .media_type() EmulatedMediaType

Cookies

These options are not yet implemented

Custom HTTP Headers

Gotenberg Option Route Configuration Python Type Notes
extraHttpHeaders .headers() dict[str, str] The dictionary of values will be JSON encoded for you

HTTP Status Codes

Gotenberg Option Route Configuration Python Type Notes
failOnHttpStatusCodes .fail_on_status_codes() Iterable[int]

Console Exceptions

Gotenberg Option Route Configuration Python Type Notes
failOnConsoleExceptions
  • fail_on_exceptions()
  • dont_fail_on_exceptions()
N/A

Performance Mode

Gotenberg Option Route Configuration Python Type Notes
skipNetworkIdleEvent
  • skip_network_idle()
  • use_network_idle()
N/A

PDF/A & PDF/UA

Gotenberg Option Route Configuration Python Type Notes
pdfa .pdf_format() PdfAFormat
pdfua
  • enable_universal_access()
  • disable_universal_access()
N/A

PDF Metadata Support

Gotenberg Documentation

Add metadata to your PDFs:

from gotenberg_client import GotenbergClient
from datetime import datetime

with GotenbergClient("http://localhost:3000") as client:
    with client.chromium.html_to_pdf() as route:
        response = (route
            .index("my-index.html")
            .metadata(
                title="My Document",
                author="John Doe",
                creation_date=datetime.now(),
                keywords=["sample", "document"],
                subject="Sample PDF Generation",
                trapped="Unknown"
            )
            .run())

Supported metadata fields:

  • title: Document title
  • author: Document author
  • subject: Document subject
  • keywords: List of keywords
  • creator: Creating application
  • creation_date: Creation datetime
  • modification_date: Last modification datetime
  • producer: PDF producer
  • trapped: Trapping status ('True', 'False', 'Unknown')
  • copyright: Copyright information
  • marked: PDF marked status
  • pdf_version: PDF version number

LibreOffice

Office Documents to PDF

Gotenberg Link Route Access Required Properties Optional Properties
Documentation libre_office.to_pdf
  • .convert("mydoc.docx")
  • or
  • .convert_files(["mydoc.docx"])
See common LibreOffice options

Additional Notes:

  • convert may be called multiple times
  • convert_files is a convenience method to convert a list of file into PDF

LibreOffice Properties

Page Properties

Gotenberg Option Route Configuration Python Type Notes
landscape .orient() PageOrientation
nativePageRanges page_ranges() str
exportFormFields N/A N/A This option is not implemented yet
singlePageSheets N/A N/A This option is not implemented yet

Merge

Gotenberg Option Route Configuration Python Type Notes
merge
  • merge()
  • no_merge()
N/A

Additional Notes:

  • If multiple files are provided, and the merge is left as default or no_merge() is called, the resulting file will be a zip

PDF/A & PDF/UA

Gotenberg Option Route Configuration Python Type Notes
pdfa .pdf_format() PdfAFormat
pdfua
  • enable_universal_access()
  • disable_universal_access()
N/A

Metadata

Gotenberg Documentation

These options are not yet implemented

Convert

Gotenberg Link Route Access Required Properties Optional Properties
Documentation pdf_a.to_pdfa
  • .convert("mydoc.pdf")
  • or
  • .convert_files(["mydoc.pdf"])
pdfa .pdf_format() PdfAFormat
pdfua
  • enable_universal_access()
  • disable_universal_access()
N/A

Additional Notes:

  • At least one of pdf_format(), enable_universal_access() or disable_universal_access() must be set

Merge

Gotenberg Link Route Access Required Properties Optional Properties
Documentation merge.merge
  • .merge(["file1.pdf", "file2.pdf"])
pdfa .pdf_format() PdfAFormat
pdfua
  • enable_universal_access()
  • disable_universal_access()
N/A
metadata N/A N/A This option is not implemented yet

Additional Notes:

  • The library will add prefixes to the file to ensure they are merged in the order provided to merge()

Health Check