View Source Api2pdf.Chrome (Api2pdf v0.1.1)

Convert HTML document, web page to PDF or Image using Headless Chrome backend.

Link to this section Summary

Functions

Convert HTML document to Image with default configuration.

Convert HTML document to PDF with default configuration.

Send a convert request with an option to specify complete parameters that are supported by the API.

Convert URL to image with default configuration.

Convert URL to PDF with default configuration.

Link to this section Functions

Link to this function

html_to_image(html, options \\ [])

View Source
@spec html_to_image(
  String.t(),
  keyword()
) :: {:error, any()} | {:ok, ApiSuccessResponse.t()}

Convert HTML document to Image with default configuration.

For a full control of request options please use request/2.

examples

Examples

Api2pdf.Chrome.html_to_image("<p>", tag: "some-tag")
Link to this function

html_to_pdf(html, options \\ [])

View Source
@spec html_to_pdf(
  String.t(),
  keyword()
) :: {:error, any()} | {:ok, ApiSuccessResponse.t()}

Convert HTML document to PDF with default configuration.

For a full control of request options please use request/2.

examples

Examples

Api2pdf.Chrome.html_to_pdf("<p>", tag: "some-tag")
Link to this function

request(payload, options \\ [])

View Source
@spec request(
  %{
    :__struct__ =>
      Api2pdf.Model.ChromeHtmlToImageRequest
      | Api2pdf.Model.ChromeHtmlToPdfRequest
      | Api2pdf.Model.ChromeUrlToImageRequest
      | Api2pdf.Model.ChromeUrlToPdfRequest,
    optional(any()) => any()
  },
  keyword()
) :: {:error, any()} | {:ok, ApiSuccessResponse.t()}

Send a convert request with an option to specify complete parameters that are supported by the API.

Payloads are modeled in the form of struct and options is keyword.

Available request payloads:

examples

Examples

payload = %Api2pdf.Model.ChromeHtmlToPdfRequest{url: "https://example.com", inline: false}
result = request(payload, tag: "some-tag")
Link to this function

url_to_image(url, options \\ [])

View Source
@spec url_to_image(
  String.t(),
  keyword()
) :: {:error, any()} | {:ok, ApiSuccessResponse.t()}

Convert URL to image with default configuration.

For a full control of request options please use request/2.

examples

Examples

Api2pdf.Chrome.url_to_image("https://example.com", tag: "some-tag")
Link to this function

url_to_pdf(url, options \\ [])

View Source
@spec url_to_pdf(
  String.t(),
  keyword()
) :: {:error, any()} | {:ok, ApiSuccessResponse.t()}

Convert URL to PDF with default configuration.

For a full control of request options please use request/2.

examples

Examples

Api2pdf.Chrome.url_to_pdf("https://example.com", tag: "some-tag")