Provides functions to convert URLs, HTML, and Markdown files into PDFs or screenshots.
Summary
Functions
Converts HTML file content into a PDF using Chromium.
Converts HTML file content into a screenshot using Chromium.
Converts Markdown files into a PDF using Chromium.
Converts Markdown files into a screenshot using Chromium.
Converts a URL into a PDF using Chromium.
Converts a URL into a screenshot using Chromium.
Types
@type console_exception_option() :: {:fail_on_console_exceptions, boolean()}
@type cookie_option() :: {:cookies, [cookie()]}
@type flatten_option() :: {:flatten, boolean()}
@type invalid_http_status_codes_option() :: {:fail_on_http_status_codes, [non_neg_integer()]} | {:fail_on_resource_http_status_codes, [non_neg_integer()]}
@type media_type_option() :: {:emulate_media_type, String.t()}
@type metadata_option() :: {:metadata, map()}
@type network_error_option() :: {:fail_on_resource_loading_failed, boolean()}
@type page_property_option() :: {:single_page, boolean()} | {:paper_width, float()} | {:paper_height, float()} | {:margin_top, float()} | {:margin_bottom, float()} | {:margin_left, float()} | {:margin_right, float()} | {:prefer_css_page_size, boolean()} | {:generate_document_outline, boolean()} | {:generate_tagged_pdf, boolean()} | {:print_background, boolean()} | {:omit_background, boolean()} | {:landscape, boolean()} | {:scale, float()} | {:native_page_ranges, String.t()}
@type pdf_option() :: page_property_option() | wait_option() | media_type_option() | cookie_option() | custom_http_header_option() | invalid_http_status_codes_option() | network_error_option() | console_exception_option() | performance_mode_option() | split_option() | pdfa_pdfua_option() | metadata_option() | flatten_option()
@type performance_mode_option() :: {:skip_network_idle_event, boolean()}
@type screenshot_option() :: {:width, non_neg_integer()} | {:height, non_neg_integer()} | {:clip, boolean()} | {:format, String.t()} | {:quality, non_neg_integer()} | {:omit_background, boolean()} | {:optimize_for_speed, boolean()} | wait_option() | media_type_option() | cookie_option() | custom_http_header_option() | invalid_http_status_codes_option() | console_exception_option() | performance_mode_option()
Functions
@spec html_file_into_pdf(binary(), files(), [pdf_option()]) :: {:ok, GotenbergElixir.HttpClient.Behaviour.response()} | {:error, GotenbergElixir.HttpClient.Behaviour.error()}
Converts HTML file content into a PDF using Chromium.
## Parameters
html: The HTML content as a binary string.additional_files: A list of additional files (images, CSS, fonts) as {filename, file}options: Optional parameters passed as a keyword list.
## Options For a list of all available options, refer to the official Gotenberg documentation.
@spec html_file_into_screenshot(binary(), files(), [screenshot_option()]) :: {:ok, GotenbergElixir.HttpClient.Behaviour.response()} | {:error, GotenbergElixir.HttpClient.Behaviour.error()}
Converts HTML file content into a screenshot using Chromium.
## Parameters
html: The HTML content as a binary string.additional_files: A list of additional files (images, CSS, fonts) as {filename, file}options: Optional parameters passed as a keyword list.
## Options For a list of all available options, refer to the official Gotenberg documentation.
@spec markdown_files_into_pdf(String.t(), files(), [pdf_option()]) :: {:ok, GotenbergElixir.HttpClient.Behaviour.response()} | {:error, GotenbergElixir.HttpClient.Behaviour.error()}
Converts Markdown files into a PDF using Chromium.
## Parameters
index_html: The HTML template content that wraps the markdown (uses{{ toHTML "filename.md" }}syntax).markdown_files: A list of markdown files as {filename, file}options: Optional parameters passed as a keyword list.
## Options For a list of all available options, refer to the official Gotenberg documentation.
@spec markdown_files_into_screenshot(String.t(), files(), [screenshot_option()]) :: {:ok, GotenbergElixir.HttpClient.Behaviour.response()} | {:error, GotenbergElixir.HttpClient.Behaviour.error()}
Converts Markdown files into a screenshot using Chromium.
## Parameters
index_html: The HTML template content that wraps the markdown (uses{{ toHTML "filename.md" }}syntax).markdown_files: A list of markdown files as {filename, file}options: Optional parameters passed as a keyword list.
## Options For a list of all available options, refer to the official Gotenberg documentation.
@spec url_into_pdf(String.t(), [pdf_option()]) :: {:ok, GotenbergElixir.HttpClient.Behaviour.response()} | {:error, GotenbergElixir.HttpClient.Behaviour.error()}
Converts a URL into a PDF using Chromium.
## Parameters
url: The URL to convert.options: Optional parameters passed as a keyword list.
## Options For a list of all available options, refer to the official Gotenberg documentation.
@spec url_into_screenshot(String.t(), [screenshot_option()]) :: {:ok, GotenbergElixir.HttpClient.Behaviour.response()} | {:error, GotenbergElixir.HttpClient.Behaviour.error()}
Converts a URL into a screenshot using Chromium.
## Parameters
url: The URL to convert.options: Optional parameters passed as a keyword list.
## Options For a list of all available options, refer to the official Gotenberg documentation.