需要用到的网址
后端服务
Django
前端框架
BootStrap5
前端设计
Html-Color
1、下载pdf
其实生成pdf界面那里就可以直接下载pdf了
关键代码
def downloadPDF(file_path):
if os.path.exists(file_path):
with open(file_path, 'rb') as fh:
response = HttpResponse(fh.read(), content_type="application/pdf")
response['Content-Disposition'] = 'inline; filename=' + os.path.basename(file_path)
return response
raise Http404
https://stackoverflow.com/questions/54034447/how-to-download-a-pdf-file-with-python-to-local-machine