View Source ChromicPDF.Supervisor (ChromicPDF v1.15.2)

Use this for multiple ChromicPDF instances.

when-is-this-useful

When is this useful?

  • You want to completely separate two or more PDF worker pools
  • You want to give your PDF module a custom API

usage

Usage

defmodule MyApp.MyPDFGenerator do
  use ChromicPDF.Supervisor
end

def MyApp.Application do
  def start(_type, _args) do
    children = [
      MyApp.MyPDFGenerator
    ]

    Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
  end
end

Link to this section Summary

Functions

Fetches pids of the supervisor's services and passes them to the given callback function.

Link to this section Types

@type services() :: %{browser: pid(), ghostscript_pool: pid()}

Link to this section Functions

@spec child_spec([ChromicPDF.global_option()]) :: Supervisor.child_spec()
Link to this function

with_services(name, fun)

View Source
@spec with_services(atom(), (services() -> any())) :: any()

Fetches pids of the supervisor's services and passes them to the given callback function.

If ChromicPDF has been configured to run in on_demand mode, this will start a temporary browser instance.