Last active
December 26, 2015 12:19
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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