Generally that's done by spitting out some custom headers; Content-Type: text/pdf Content-Disposition: attachment; filename=yourfilename.pdf
That way most browsers will give you the option to open or to save- as. To do that does require that they're sent dynamically, but as said before it'd be a shame to use Django for that because of the overhead you incur. Better off to just write some mod_python module that will handle that sort of things. IMO, anyway :) On 17/07/2007, at 3:29 PM, Arnold Chen wrote: > > Besides, i want to revise my first question as: > > How to serve static file by "pushing" a PDF to client? In php, there > is a way to serve PDF by pushing the file to the client, and client to > choose "Save As" or "Open" the file directly. > > Adobe reader is very slow if they run in browsers, and most of the > time, they hang the browser, so is there a way to push ? > > regards, > Arnold > > On Jul 17, 4:03 pm, Arnold Chen <[EMAIL PROTECTED]> wrote: >> Thanks Ben, >> >> Besides, i've found thatwww.lawrence.comandwww.ljworld.com(which >> are famous sites that use django) use ahttp://media.their-domain- >> name.com >> to store the media files. >> All static files, images, css are from thehttp://media.their- >> domain-name.com >> server. Obviously the media subdomain is not a django environment, i >> wonder if we can setup an environment like that, and can i still >> upload image to the media subdomain from the django admin console? >> >> Arnold >> >> On Jul 17, 3:29 pm, Ben van Staveren <[EMAIL PROTECTED]> >> wrote: >> >>> You're better off not doing it with Django, just make a directory >>> that won't be handled by Django and stick all your static content in >>> there. After all, the webserver is usually better at serving static >>> files than Django is :) >> >>> On 17/07/2007, at 2:26 PM, Arnold Chen wrote: >> >>>> Can any one please tell me how to serve a static PDF in django ? >>>> The >>>> file is located in the server, and do not need to be created on the >>>> fly (by using report lab). I have done it in PHP by using >>>> header, but >>>> i just don't know how to do it with django. Thanks > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" 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/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

