문제

I would like to create a pdf file with the tool "reportlab". Afterwards I'd like to save the created file in a given directory (so to say in a given folder)

Here is the code for creating my PDF:

def pdfLeereRechnung(request):
response = HttpResponse(content_type='application/pdf')
filename = str("LR_" + str(article) + "_" + str(first_name) + "_" + str(last_name) + "_" + str(date.today().year))
response['Content-Disposition'] = 'attachment; filename=' + filename + ".pdf"

p = canvas.Canvas(response, pagesize=A4) 
#Do something,...
p.showPage()
p.save()
return response

Creating the PDF works perfectly, but I don't want to save my files into "Downloads". So here is my question: Is it possible, to say something like: p.save_in("C/folder/...")? Thank you very much for your help

도움이 되었습니까?

해결책

You are not able to tell the user agents (their web browsers) where to save downloaded files. It doesn't make sense, you don't even know their folder structure.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top