Skip to content

Instantly share code, notes, and snippets.

@beschauer
Last active December 26, 2015 12:19
Show Gist options
  • Save beschauer/7150045 to your computer and use it in GitHub Desktop.
Save beschauer/7150045 to your computer and use it in GitHub Desktop.
'inline' in Content_Disposition rather than 'attachment' tells browser to display pdf directly. With 'attachment' the browser would immediately download playframework
private def generatePdf(implicit request: RequestHeader) = {
val pdf = generator.createPDF()
SimpleResult(
header = ResponseHeader(200),
body = Enumerator(pdf)).withHeaders(
(CONTENT_DISPOSITION, "inline; filename=my.pdf"),
(CONTENT_TYPE, "application/pdf")
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment