View Source ChromicPDF.Plug (ChromicPDF v1.17.0)
This module implements a "request forwarding" mechanism from an internal endpoint serving
incoming requests by Chrome to the print_to_pdf/2
caller process.
usage
Usage
In your router:
forward "/makepdf", ChromicPDF.Plug
On the caller side:
ChromicPDF.print_to_pdf(
{:plug,
url: "http://localhost:4000/makepdf",
forward: {MyTemplate, :render, [%{hello: :world}]
}
)
defmodule MyTemplate do
def render(conn, assigns) do
# send response via conn (and return conn) or return content to be sent by the plug
end
end