Putting a PDF document on my site

You cannot put the pdf anywhere, it should be accessible from the web server…

You can do this like this

  • create a pdfs folder in assets/static
  • add all pdfs inside this folder
  • enable pdfs in plug static, for this, update your endpoint
  plug Plug.Static,
    at: "/",
    from: :lo_tube,
    gzip: false,
    only: ~w(css fonts images js favicon.ico robots.txt pdfs)
  • Then You can reference them as /pdfs/any.pdf, or with Routes static helper
4 Likes