View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
(NOTE: The user sent links to the two files via email.  Our reply is copied here for future reference).
 

I can't explain the problem, but I am getting the same result when I connect to your server with IE. When I use Mozilla and Netscape both files display properly.

I downloaded the two files to my computer and could open them with no problem. This means that the data is received correctly. I also compared the HTTP headers sent by your server for the two files and they are identical.

I used the following program and got very strange results:

<%

M.FileName = "MyFile.pdf"

M.FileContent = ReadFile(M.FileName)

Response.Buffer = .T.

Response.ContentType = "application/pdf"

Response.AddHeader("Content-Length", Server.ToString(LEN(M.FileContent)))

Response.Write(M.FileContent)

%>

Basically, I was getting intermittent failures and successes in IE, while in other browsers it worked fine all the time (by success I mean that the file was properly rendered by the Acrobat plug-in). I got successes and failures for both files, so I don't know why there's a difference between the two files when accessed from your server. Could it be the file size?

In general, I have seen many problems when programmers tried to return PDF files from server side applications (not just FoxWeb). These problems seem to either be related to the Acrobat plug-in for IE, or to the interaction between IE and IIS. In all cases the file was viewed successfully if saved in the Web tree and the browser was redirected to it.

FoxWeb Support Team
support@foxweb.com email

Sent by Joe Cooperrider on 10/23/2002 11:22:25 AM:
If the MIME type were incorrect, would any PDF file open? What baffles me is that a couple of documents open correctly but most do not.
 
To rule out a readfile problem, I ran the readfile and then ran writefile and I was able to open the saved document (not in the browser).
 
 
Sent by FoxWeb Support on 10/22/2002 11:51:46 PM:
The method you are using should work, but doesn't always. In most cases the problem is caused by limitations/bugs in the Acrobat Reader plugin, but I was under the impression that this was fixed in recent versions. I have also seen similar problems with other environments, such as ASP and Cold Fusion.
 
Having said this, the fact that FoxWeb returns the PDF code without launching Acrobat puzzles me. Are you saying that you actually see the PDF code in the browser? If this is the case, then the problem is most probably related to an incorrect MIME header. Can you provide access to a server that exhibits this behavior and instructions on how to reproduce it? I will try to connect with a raw HTTP client to view all headers returned by your server.
 
Another recomendation, which is actually also made by Adobe, is to redirect users to a static file in the Web tree, instead of dynamically generating the file in the reply from a server-side script.
 
For your reference, you may also want to check the following articles:
 
 

FoxWeb Support Team
support@foxweb.com email

Sent by Joe Cooperrider on 10/20/2002 06:00:56 PM:
Hello all,
 
I am trying to write a function that displays a pdf file. I have a variable to store the passed file name. I am then trying to display the file with the following:
 
m.lc_filename=formfield("PDFNAME")
HML_OUT="Content type: application/pdf"+chr(10)+chr(10)+readfile(m.lc_filename)
return
 
It works on a couple of files but on 99% of files it returns the pdf code without launching Acrobat.
 
Any ideas????
 
Thanks