Print Page | Close Window

Content-type

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=286
Printed Date: 26 Nov 24 at 7:03AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Content-type
Posted By: jabaltie
Subject: Content-type
Date Posted: 26 Jan 06 at 11:17AM
This is slightly an off topic but I think it can help others...

The thing is : from a script of mine running on a Web Server and using QuickPDF, I generate a dynamic PDF from a template.

So far so good.

Then, I want the browser to open this PDF. Also, no problem, I set this http header

Content-Type: application/pdf

And I'm done. Browser opens OK the PDF.

But, user may click on Save A Copy. Then, the file name offered is very weird and ugly. It takes a piece of the URL.

I wanna suggest him/her something better. I managed to set this too :

Content-Disposition: inline;filename="invoice.pdf"


What happens next ?

1) Using FireFox, it works perfectly as intended.

2) Using MSIE, it wont recognize the filename. It keeps on using the url piece.


Have you ever faced such situation ? Am I being too "capricious" to go after such level of details ?



Replies:
Posted By: bogey
Date Posted: 26 Jan 06 at 11:45AM

I use this and it works - except for the [1] that IE appends to the filename

 Response.ContentType = "application/pdf"
 Response.AddHeader "Content-disposition",  "inline; filename=" & timer * 100 & ".pdf"
 Response.BinaryWrite QP.SaveToVariant()



Posted By: jabaltie
Date Posted: 26 Jan 06 at 11:48AM
What OS are you using ?


Posted By: jabaltie
Date Posted: 26 Jan 06 at 11:57AM
One more thing : if your site works fine, do you think you could let me know the URL ?

If so, I could access from here and monitor if it works for my browser.

If it does, I could see a whole list of the http headers that you're using, then I would copy it (FireFox has an extension called LiveHttpHeaders that let us "see" the headers underneath).

If you dont mind, of course...


Posted By: bogey
Date Posted: 26 Jan 06 at 11:58AM
Browser is IE 6 on XP Pro, server is Win2K.


Posted By: jabaltie
Date Posted: 26 Jan 06 at 12:00PM
I have tried here upon W2K and it doesnt work either....



Posted By: jabaltie
Date Posted: 26 Jan 06 at 12:25PM
Hi Bogey

Thanks so much for your help !

I've received your URL privately and it works nice and perfectly as expected.

Then, I monitored the headers using FireFox LiveHttpHeaders as I said and I noticed a very subtle difference:

Your headers are specified in this order :

Content-Disposition
Content-Type

Whereas in my case, I'm issuing

Content-Type
Content-Dispositon

This appears to be the problem.

However, now I'm in a big, big problem because :

No matter the order I specify on my script, my http server ALWAYS rearranges it to that order it likes (type/disposition).

Even worse : I no longer have support to my web server, which is WebSite, which was from OReilly and for a long time has had no support at all.

But at least I could figure out where's the problem.

Seems like I'll have to be less "capricious" now and forget about it.

Once more, thank you so much 4 your help !

Hope your talk can help others web programmers too...


Posted By: bogey
Date Posted: 26 Jan 06 at 12:40PM

The only time I have had IE scramble up the filename is if it has invalid characters in it. Verify that you have no slashes or other punctuation in the name.



Posted By: jabaltie
Date Posted: 26 Jan 06 at 1:51PM
No I dont. I use a very plain and simple filename. My filename is "arquivo.pdf" which means "file.pdf".

The problem is really regarded to the order of the http headers.

Should you want, you may try to replace the order of the headers as I said above and see what happens.

Nevertheless, I'll be on vacation from tomorrow on up to February 28 th.

So, I'll be out of contact for a while.

Again, thank you so much !



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk