Re: regarding output

2013-01-25 Thread Bill Freeman
Let's divide and conquer.  Try commenting out the stuff creating and using
"p"
and instead do

  response.write("this is a test")

See if you get a file to save in the browser, and save it, rather than
opening
it, since it won't really be pdf.  Then look at the file with something
like less
in a command line - don't try double clicking on the file, it's still not a
pdf to
see if it has the desired text.  If that works the Django side of things is
good.

I haven't touched reportlab in a few years, so I don't remember if a Canvas
is the kind of object that you need (whether it even has a save method),
so the reportlab mailing list, or getting a simple reportlab example to
write
to an open file object, would be your alternatives.

Bill

On Fri, Jan 25, 2013 at 5:26 AM,  wrote:

> from reportlab.pdfgen import canvas
> from django.http import HttpResponse
>
> def some_view(request):
> # Create the HttpResponse object with the appropriate PDF headers.
> response = HttpResponse(mimetype='application/pdf')
> response['Content-Disposition'] = 'attachment;
> filename="somefilename.pdf"'
>
> # Create the PDF object, using the response object as its "file."
> p = canvas.Canvas(response)
>
> # Draw things on the PDF. Here's where the PDF generation happens.
> # See the ReportLab documentation for the full list of functionality.
> p.drawString(100, 100, "Hello world.")
>
>
> # Close the PDF object cleanly, and we're done.
> p.showPage()
> p.save()
> return response
>
>
> this is my code , i wanna know where the output of this program is saved.
> M not able to retrieve the out put plz help me out.
> thanks in advance
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




regarding output

2013-01-25 Thread nrapeee
from reportlab.pdfgen import canvas
from django.http import HttpResponse

def some_view(request):
# Create the HttpResponse object with the appropriate PDF headers.
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; 
filename="somefilename.pdf"'

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

# Draw things on the PDF. Here's where the PDF generation happens.
# See the ReportLab documentation for the full list of functionality.
p.drawString(100, 100, "Hello world.")


# Close the PDF object cleanly, and we're done.
p.showPage()
p.save()
return response


this is my code , i wanna know where the output of this program is saved.
M not able to retrieve the out put plz help me out.
thanks in advance


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.