Re: [Zope] Displaying pdf

2005-12-01 Thread Chris Withers

Peter Bengtsson wrote:

pdffile = getattr(context, 'some.pdf')
return pdffile


I think you'd have to set a content-disposition header if you did that...

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Displaying pdf

2005-12-01 Thread Richard Smith

Chris Withers wrote:


Peter Bengtsson wrote:


pdffile = getattr(context, 'some.pdf')
return pdffile



I think you'd have to set a content-disposition header if you did that...

cheers,

Chris


I wondered, but it seems to work in both firefox and ie without.

Rick


___ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Displaying pdf

2005-12-01 Thread Peter Bengtsson
On 12/1/05, Chris Withers [EMAIL PROTECTED] wrote:
 Peter Bengtsson wrote:
  pdffile = getattr(context, 'some.pdf')
  return pdffile

 I think you'd have to set a content-disposition header if you did that...

Surely the File object that this 'some.pdf' is has all of this taken
care of in its index_html()

 cheers,

 Chris

 --
 Simplistix - Content Management, Zope  Python Consulting
 - http://www.simplistix.co.uk




--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Displaying pdf

2005-12-01 Thread Chris Withers

Peter Bengtsson wrote:

I think you'd have to set a content-disposition header if you did that...



Surely the File object that this 'some.pdf' is has all of this taken
care of in its index_html()


No, OFS.Image.File sets no content-disposition header.

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Displaying pdf

2005-11-30 Thread Rick Smith

Perhaps someone can point me in the right direction.

I am trying to display a pdf file (actually stored in LocalFS) from a
python script.  To do this my approach (probably there's a better way) is :-

RESPONSE.setHeader('Content-Type','application/pdf')
RESPONSE.redirect(path)

My main problem is that  on some occasions the file is properly opened
in acrobat (I'm using firefox on linux, but similar effects are obtained
using ie6/windows), while on other occasions raw pdf is displayed in the
browser field with a content-type of text/html. I'm unable to see any
difference to explain this difference - the documents are all scanned in
the same way and imported into acrobat in the same way, yet Zope (I
presume) interprets them as have differing content-type.

I presume that this problem would go away if I didn't use the redirect.
I'm sure it's blindingly obvious but I can't see how to do it another
way.  I'd also be happy to display the pdf within an html document/frame
but my knowledge of html is missing something at this point...

Please help me in my weakness...

Rick

.




___ 
WIN ONE OF THREE YAHOO! VESPAS - Enter now! - http://uk.cars.yahoo.com/features/competitions/vespa.html

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Displaying pdf

2005-11-30 Thread Peter Bengtsson
Why the fancy RESPONSE stuff. What's wrong with just clicking on the pdf URL?
Or like this from a python script called showPDF()

pdffile = getattr(context, 'some.pdf')
return pdffile

On 12/1/05, Rick Smith [EMAIL PROTECTED] wrote:
 Perhaps someone can point me in the right direction.

 I am trying to display a pdf file (actually stored in LocalFS) from a
 python script.  To do this my approach (probably there's a better way) is :-

 RESPONSE.setHeader('Content-Type','application/pdf')
 RESPONSE.redirect(path)

 My main problem is that  on some occasions the file is properly opened
 in acrobat (I'm using firefox on linux, but similar effects are obtained
 using ie6/windows), while on other occasions raw pdf is displayed in the
 browser field with a content-type of text/html. I'm unable to see any
 difference to explain this difference - the documents are all scanned in
 the same way and imported into acrobat in the same way, yet Zope (I
 presume) interprets them as have differing content-type.

 I presume that this problem would go away if I didn't use the redirect.
 I'm sure it's blindingly obvious but I can't see how to do it another
 way.  I'd also be happy to display the pdf within an html document/frame
 but my knowledge of html is missing something at this point...

 Please help me in my weakness...

 Rick

 .




 ___
 WIN ONE OF THREE YAHOO! VESPAS - Enter now! - 
 http://uk.cars.yahoo.com/features/competitions/vespa.html
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )



--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Displaying pdf

2005-11-30 Thread John Barham
On 12/1/05, Rick Smith [EMAIL PROTECTED] wrote:
 Perhaps someone can point me in the right direction.

 I am trying to display a pdf file (actually stored in LocalFS) from a
 python script.  To do this my approach (probably there's a better way) is :-

 RESPONSE.setHeader('Content-Type','application/pdf')
 RESPONSE.redirect(path)

It's pointless to set the content type and then to redirect since the
content type the client will get will be the content type of the
*destination* url (i.e., whatever path is, presumably the url of the
PDF document).

Why not just link directly to the document in the LocalFS object? 
IIRC, LocalFS allows you to map file extensions to content types. 
Maybe your PDF documents have case-differing extensions (e.g., .pdf
vfs. .PDF)?

  John


 My main problem is that  on some occasions the file is properly opened
 in acrobat (I'm using firefox on linux, but similar effects are obtained
 using ie6/windows), while on other occasions raw pdf is displayed in the
 browser field with a content-type of text/html. I'm unable to see any
 difference to explain this difference - the documents are all scanned in
 the same way and imported into acrobat in the same way, yet Zope (I
 presume) interprets them as have differing content-type.

 I presume that this problem would go away if I didn't use the redirect.
 I'm sure it's blindingly obvious but I can't see how to do it another
 way.  I'd also be happy to display the pdf within an html document/frame
 but my knowledge of html is missing something at this point...

 Please help me in my weakness...

 Rick
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )