Hi!

Sorry it took a while - I had to get the info from work.

Renderer mode: Quirks mode
Cache source: Not cached
Encoding: UTF-8

The other stuff was blank.

My view is as follows:

==========  SNIP ==========
from django.http import HttpResponse
from django.shortcuts import render_to_response
import urllib

def front(request):
    sock = 
urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
    html = sock.read()
    sock.close()
    return HttpResponse(html)

def officereport(request):
    selected_choice = request.POST['office']
    sock = 
urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
    html = sock.read()
    sock.close()
    return HttpResponse(html)

==========  SNIP ==========

So what thoughts are there out there amongst our experts?

Thanks heaps!

-Warren



----- Original Message ----- 
From: "oggie rob" <[EMAIL PROTECTED]>
To: "Django users" <django-users@googlegroups.com>
Sent: Monday, April 02, 2007 9:03 PM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> Ahh... botched post.
> Anyway, check the Page Info "Type" & post your view method if there
> are still problems.
>
> -rob
>
> On Apr 2, 9:02 pm, "oggie rob" <[EMAIL PROTECTED]> wrote:
>> Try looking at Firefox's "Page Info". That will tell you whether
>> Django or Firefox is the issue. It should say  Why don't you post some
>> of your view method. It might be
>>
>> On Apr 2, 7:27 pm, queezy <[EMAIL PROTECTED]> wrote:
>>
>> > Hi All!
>>
>> > I used     response = HttpResponse(pdfbytes, 
>> > mimetype='application/pdf') in my view (of course returning the 
>> > response var) and firefox still has issues - it shows pdfbytes instead 
>> > of rendering.
>>
>> > Is there anything more that I should be doing to make this work with 
>> > firefox?  I am sure that the secret to success with this is in these 
>> > lines that Ned provided.
>>
>> > Thanks so much!!
>>
>> > -Warren
>>
>> >   ----- Original Message -----
>> >   From: Ned Batchelder
>> >   To: django-users@googlegroups.com
>> >   Sent: Monday, April 02, 2007 6:50 PM
>> >   Subject: Re: Django app serves PDFs but browser doesn't render them
>>
>> >   We serve PDFs, both in-browser, and out.  Here the lines to set the 
>> > type and disposition:
>>
>> >       response = HttpResponse(pdfbytes, mimetype='application/pdf')
>> >       response['Content-Disposition'] = 'attachment; filename=foo.pdf'
>> >       return response
>>
>> >   Here pdfbytes are the actual bytes of the PDF file.  With the 
>> > Content-Disposition line, Firefox will display the Save As dialog to 
>> > save the file someplace.  Without that line, the PDF is displayed in 
>> > the browser.
>>
>> >   --Ned.
>>
>> >   Malcolm Tredinnick wrote:
>> > On Mon, 2007-04-02 at 18:02 -0700, queezy wrote:
>> >   Hi All!
>>
>> > We have a Django application that uses a form to allow users to select
>> > offices and it sends them off to a pdf.  At the present time we are 
>> > using
>> > FireFox on a Linux box and we are just using the Django loopback server 
>> > for
>> > the time being.  This means that we don't have a secondary, or even a
>> > primary instance of Apache working for us.
>>
>> > So when you select an office and the pdf is served up you see binary 
>> > codes
>> > dumped on your screen.
>>
>> > That sounds like you haven't set the mimetype correctly. Firefox should
>> > ask what application to use for anything it can't render natively. The
>> > fact that you are seeing bytes sent to the screen suggests you are
>> > sending it across with the HTML or some text-derivative mimetype so 
>> > that
>> > Firefox things it should display this directly.
>>
>> >   By itself, if I fire up FireFox and go to the pdfs, I am prompted for 
>> > what
>> > viewer to use, and choose postscript viewer and all is well.  So the 
>> > browser
>> > is capable of rendering pdfs properly.
>>
>> > Any constructive comments on this?  Any advice on getting the browser 
>> > to
>> > actually render the pdfs?
>>
>> > Browsers usually (I was going to say always, but I'm not sure what
>> > native-PDF-underneath-MacOS does) hand off PDF rendering to a
>> > third-party app. Sometimes that third-party app it is configured as a
>> > browser plugin.
>>
>> > I personally have no experience to share here because I prefer to use 
>> > an
>> > external app for PDF rendering, as my browser window is not the right
>> > size for viewing generated-for-print-page documents, so I like being
>> > able to resize them separately.
>>
>> > Regards,
>> > Malcolm
>>
>> > --
>> > 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