This works great, but it does not handle multiple pages in my PDF.
here is my code:
# Print Generated tags for bike intake
def taggen_print():
rows = db(db.bike_no.id > 0).select()
for row in rows:
tag_no = row.bike_typ+str(row.id)
pfile = tag_no+'_p.pdf'
pdf = FPDF()
pdf.add_page()
pdf.set_font('Arial', 'B', 14)
pdf.cell(40,10,tag_no)
pdf.output(name=request.folder + '/static/temp.pdf')
response.headers['Content-Disposition']='attachment.filename =' + pfile
response.headers['Content-Type']='application/pdf'
return response.stream(open(request.folder+'/static/temp.pdf',
'rb'),chunk_size=4096)
# pdf.output(pfile, 'F')
redirect(URL("index"))
so my end result should be a pdf with multiple pages ... I am sure it is in
the identation, I will keep trying.
thanks so much, this is working great!
On Tuesday, November 20, 2012 10:28:23 AM UTC-6, Paul Rykiel wrote:
> Thank you Peter, I will try and let you know
> On Tuesday, November 20, 2012 4:09:44 AM UTC-6, peter wrote:
>>
>> Okay, now I am understanding what you are after Paul.
>>
>> Try this
>>
>> pdf.output(name=request.folder+'/static/temp.pdf')
>> response.headers['Content-Disposition'] = 'attachment;
>> filename=abc.pdf'# to force download as attachment
>> # replace abc with whatever pdf name you want the user to see.
>> response.headers['Content-Type']='application/pdf'
>> return
>> response.stream(open(request.folder+'/static/temp.pdf','rb'),chunk_size=4096)
>>
>>
>>
>> Peter
>>
>> On Tuesday, 20 November 2012 05:57:43 UTC, Paul Rykiel wrote:
>>>
>>> Greetings...
>>>
>>> I am using PYFPDF to create my pdf's ... all is great, but instead of
>>> automatically creating the PDF, I would like the system to prompt the user
>>> to enter the directory where they want the PDF saved to? Can this be done,
>>> this would be a big help.
>>>
>>> Thanks in advance for your assistance
>>> Regards,
>>>
>>>
>>>
>>
--