I'm creating a pdf document dynamically, I need to include barchart
data in the document. The  bar chart data is also created dynamically
with report lab. I can get the barchart data at my url ...

def barchart_interests(request):

.............


    #get a GIF (or PNG, JPG, or
whatever)
    binaryStuff = d.asString('gif')

    return HttpResponse(binaryStuff, 'image/gif')

Now I want to use that barchart in my pdf ...

def dyn_pdf(request):

   buffer = StringIO()

    # Create the PDF object, using the StringIO object as its
"file."
    p = canvas.Canvas(buffer)

    # Get the HttpResponseObject
    image = interests_barchart(request)

    # Insert the image into the pdf document
    p.drawInlineImage(image, 100,350, width=100,height=100)

    p.showPage()
    p.save()

Things that I've tried ....

       p.drawInlineImage(image._get_contents, 100,350,
width=100,height=100)
       Attribute Error: 'function' object has no attribute 'format'

       p.drawInlineImage(image.content, 100,350, width=100,height=100)
       I/O Error: Cannot open resource "GIF87a

I know that PHP has a function called get_file_from_contents() or
something similar to that. I'm not entirely sure what I should be
doing here to get the .gif image from the HttpResponseObject. I can
access the barchart no problem with my browser

Thanks


--~--~---------~--~----~------------~-------~--~----~
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