In my current application, when I click PDF View button, that time PDF is opened in new window and after that we can download the PDF file. During download time it is throwing error for chrome and Edge browser but it is working for IE and Firefox. I searched google I have found similar type of issue fixed using browser content setting. If I applied same, that time PDF View option direct download the pdf file but expected Behavior is first we can view the pdf after that we download the pdf file.
type_parameter = "application/pdf; charset=UTF-8"
header = [("Content-Disposition", "filename=%s" % file_name),('Content-type',
'application/pdf; charset="UTF-8"')]
Could someone tell how to fixed this issue?
Image1:
Network Failed error:
thanks in advance
Python Code:
content = create_pdf_file()
type= "application/pdf"
h= [("Content-Disposition", "filename=%s" % file_name),('Content-type', 'application/pdf; charset="UTF-8"')]
self._ctx.iLib.forward("display", content, type, h)
display.tmpl:
#def __call__(data, Ctype="application/pdf", h=None)
*##slurp
#set self.Ctype= Ctype
#if not h
#set h= []
#end if
#for name, value in h:
#if name.lower() == 'content-type':
#set self.Ctype= value
#silent $headers.remove((name, value))
#end if
#end for
#set self.h= h
#return data

