View Source Api2pdf.Chrome (Api2pdf v0.3.0)
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
@spec html_to_image( String.t(), keyword() ) :: {:error, any()} | {:ok, Api2pdf.Model.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")
@spec html_to_pdf( String.t(), keyword() ) :: {:error, any()} | {:ok, Api2pdf.Model.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")
@spec request( %{ :__struct__ => Api2pdf.Model.ChromeHtmlToImageRequest | Api2pdf.Model.ChromeHtmlToPdfRequest | Api2pdf.Model.ChromeUrlToImageRequest | Api2pdf.Model.ChromeUrlToPdfRequest, optional(any()) => any() }, keyword() ) :: {:error, any()} | {:ok, Api2pdf.Model.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:
Api2pdf.Model.ChromeHtmlToImageRequest
Api2pdf.Model.ChromeHtmlToPdfRequest
Api2pdf.Model.ChromeUrlToImageRequest
Api2pdf.Model.ChromeUrlToPdfRequest
examples
Examples
payload = %Api2pdf.Model.ChromeHtmlToPdfRequest{url: "https://example.com", inline: false}
result = request(payload, tag: "some-tag")
@spec url_to_image( String.t(), keyword() ) :: {:error, any()} | {:ok, Api2pdf.Model.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")
@spec url_to_pdf( String.t(), keyword() ) :: {:error, any()} | {:ok, Api2pdf.Model.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")