score:0

To do this you have to return your file content in response with MIME type set to application/pdf.

score:0

Official Document suggests to use Ok.sendFile with inline = true. Play will try to find out proper MIME type for you.

def index = Action {
  Ok.sendFile(
    content = new java.io.File("/tmp/fileToServe.pdf"),
    inline = true
  )
}

Related Query

More Query from same tag