I'm using django for a small project and I would make users able to download a pdf that's already existed in media/doc/
path
so I wrote this code
with open('media/doc/document.pdf', 'r',encoding='latin1',errors='replace') as pdf:
response = FileResponse(pdf.read(), content_type='application/pdf')
response['Content-Disposition'] = 'inline;filename=some_file.pdf'
return response
but when the pdf file get downloaded it's shown pages empty btw I have already tried utf-8 encoding and doesn't work for me even this doesn't work for me
So How can I make pages visible?