Empty pdf on a windows 2003

I'm having problems producing a pdf file on a specific W2003 box.

On two seemingly identical w2003 boxes (a virtual and a physical test server) I get different results producing a pdf file:

Dim pdf1 As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf
pdf1.BindXML(System.Web.HttpContext.Current.Server.MapPath("frame.xml"), Nothing)
pdf1.Save("x.pdf", SaveType.OpenInAcrobat, Response)

On the virtual server the pdf renders fine.

On the testserver the pdf renders to an empty document that is named as the virtual site (ie virtual site is test = test.pdf). The file downloads file, but when opening the file adobe reader prompts saying "cound not open.... because ... not supported file type or.... damaged...".

I think it may be IIS differences between the machines, but am unsure where to start looking/debugg'in.

If I replace the Save call with this:

pdf1.Save(Server.MapPath(String.Format("{0}.Pdf", "xyz")))

The file is produced just fine on both servers.

If I replace the Save call with this:

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
pdf1.Save(Response.OutputStream)
Response.End()

and

a) run the page from the local host on the testserver I'm prompted to download an unknown file. After downloading this unknown file and adding the extension pdf the file loads correctly.

b) run the page via its ip (not localhost) the page first appears "all white" or empty, but appears just fine loaded in adobe reader after I hit F5 (refresh).

Any clues?

Dear mulmad,

Honestly I am not with IIS settings, but please try the following approaches,

  1. What happen if you try to Save the pdf file as an other document;

  2. Check out Adobe Reader Preferences-> Internet->Web Browser options, see if choose the Display PDF in browser;

Also this page could be helpful for you.

http://www.microsoft.com/china/technet/community/columns/insider/iisi0903.mspx#ENB

Best regards,

To make sure the setting of your server is correct, you can try open an existing Pdf with FileStream and then write it into the OutputStream.

We had the exact same issue. Finally figured out that HttpCompression was what was causing it. You will most likely find that if you disable HttpCompression on the server your problem will be fixed. The other option is to make sure that you are not compressing the PDF mime type.

Thank you for letting us know the reason.