I'm using a WAM to download A PDF to a browser
Webroutine Name(get_File) Response(#http1
#http1.ContentFile := #filepath
#http1.AttachmentFileName := #docnam
#http1.ContentType := #mimetype
In the browser this downloads the document. I'd like it to open in another tab for the user to view rather than to download then open it.
I gather this behaviour is controlled by the content-disposition tag eg
Content-Disposition: attachment; filename=HTTP_Succinctly.pdf
I think I need to set this to :inline but I cannot see a way to do this.
Can it be done in LANSA?
Downloading PDFs using WAMS
Re: Downloading PDFs using WAMS
Don't set the attachment file name.
To open in a new window set the show_in_new_window property to true.
HTH
To open in a new window set the show_in_new_window property to true.
HTH
Re: Downloading PDFs using WAMS
the Response object doesn't have a 'show_in_new_window property and if I don't set the file name property the user won't see the correct file name.
Re: Downloading PDFs using WAMS
1. Instead of setting the attachment file name using #http1.AttachmentFileName := 'mydocname'
add the header yourself: #http1.AddHeader( 'Content-disposition', 'inline; filename=mydocname')
2. The 'show_in_new_window' property is a weblet property. Look at the std_lob weblet.
add the header yourself: #http1.AddHeader( 'Content-disposition', 'inline; filename=mydocname')
2. The 'show_in_new_window' property is a weblet property. Look at the std_lob weblet.
Re: Downloading PDFs using WAMS
Abels, thank you for that it makes sense. I've never used WAMs as they were originally designed - only as a way of delivering content (eg pdfs or json).
Re: Downloading PDFs using WAMS
AbelS
That works beautifully! Thanks again for the help.
That works beautifully! Thanks again for the help.