Tomasz Narloch pisze: > Hi, > > mod_wsgi: When I want to download a invoice in pdf I get: 404 Not Found > On paster server: I'm getting my invoice in pdf without any problem > > I generate invoice in pdf on the fly. > I use reportlab and my function is something like that: > > def getInvoice(): > [...] > buffer = StringIO.StringIO() > doc = SimpleDocTemplate( > buffer, > showBoundary=0, > topMargin=0.75*inch, > rightMargin=0.5*inch, > leftMargin=0.5*inch, > bottomMargin=0.75*inch, > allowSplitting=1, > pagesize=A4, > pageCompression=1 # in my pdf not work with ttf font without > images, plain text with tables, paragraphs > ) > [...] > buffer.seek(0) > return buffer > > # NEXT in controller method: > > [...] > response.headers['Content-type'] = 'application/pdf' > response.headers['Content-disposition'] = 'attachment; filename=%s' > % filename > > buffer = invoice.getInvoice(...) > > ## !!! SOMEWHERE IS PROBLEM !!! ## > content = buffer.getvalue() > > response.headers['Content-Length'] = str(len(content)) # without > this line also not work > > buffer.close() > return content > > > I don't know where is problem. Maybe something is missing? > > When I saving pdf to disk and next method get pdf then it's work: > > fapp = fileapp.FileApp(path_to_pdf) > fapp.content_disposition(filename=filename_of_pdf) > return fapp(request.environ, self.start_response) > > but I don't want to save pdf to disk. > > Best Regards, > Tomek > I missing add that I get error by Apache: TypeError: expected string object for header value
Version of mod_wsgi 2.2 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
