Putting a PDF document on my site

Am trying to put a pdf on my site using
<embed src="D:/zig.pdf" width="700px" height="900px">
but am getting the error below
users:1 Not allowed to load local resource: file:///D:/zig.pdf

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

thanks it has worked