def print_page!(ws_address, url, opts \\ []) do ws_uri = URI.parse(ws_address) args = Keyword.merge( [ socket_args: [{ws_uri.host, ws_uri.port}, [path: ws_uri.path]], ], opts ) {:ok, printer} = __MODULE__.start_link(args) print_page(printer, url, opts) end defp print_page(printer, url, opts) do timeout = Keyword.get(opts, :timeout, @default_timeout) GenServer.call(printer, {:print_pdf, url, opts}, timeout) end
Обсуждают сегодня