You are absolutely right.  I have tested this approach and for my
purposes it is working great.  Thanks for the insight.

On Aug 23, 9:50 pm, Ned Batchelder <[EMAIL PROTECTED]> wrote:
> You can probably skip the StringIO.  HttpResponses support a file-like
> interface, so you can write directly to them.  Try passing the
> HttpResponse directly to the SimpleDocTemplate constructor instead.
>
> --Ned.http://nedbatchelder.com/blog
>
>
>
> abrightwell wrote:
> > Nevermind, the main problem I seemed to be having was "associating"
> > the pdf with the HttpResponse.  Instead of writing the PDF to a file,
> > I found through some more research that all you need to is use a
> > StringIO buffer and then write the value of the buffer to the
> > HttpResponse.  I found this information in some other posts and other
> > random places out there.  Based on those, here is a brief example of
> > what is currently working for me.
>
> > example:
>
> > # all necessary imports
>
> > buffer = StringIO()
> > doc = SimpleDocTemplate(buffer, pagesize)
> > ... # compile all information for pdf.
> > doc.build(information)
> > response.write(buffer.getvalue())
> > buffer.close()
> > return response
>
> > On Aug 23, 1:12 pm, abrightwell <[EMAIL PROTECTED]> wrote:
>
> >> So, I have been playing around with reportlab and django in order to
> >> generate pdf's of information from my application.  I have played with
> >> the example of using reportlab found in the django documentation but
> >> it seems a bit tedious for my purposes (painting everyline).  Being
> >> able to use SimpleDocTemplate would seem to be the better approach.
> >> Has anyone used it in this way?
>
> --
> Ned Batchelder,http://nedbatchelder.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to