Generating PDF

H

Hans Preuer

Hi

I will generate a PDF with ASP.NET and send it to a popup window. For this,
I use sharpPDF, a licensefree
DLL which works quite well, and the "Content-Disposition"
HTML directiv. For the output, I use the following code::

Dim openSpecScript As String = "<" & "script language=""JavaScript"">" & _
"var win = window.open('SpecRep1.aspx?rq_file=" &
Server.UrlEncode(strSpecFile) & "', " & _
"'pdfrepspec1', " & _
"'width=700,height=500,scrollbars=yes,location=no,menubar=no,resizable=yes,toolbar=no,status=yes');"
& _
"</" & "script>"
Response.Write(openSpecScript)

In "SpecRep1.aspx" I use the following code in Page_Init:

Dim strFile As String = Server.UrlDecode(Request.QueryString("rq_file"))
If strFile.Length > 1 Then
Response.ContentType = "application/pdf"
Response.AppendHeader("Content-Disposition", "inline;filename=" &
strFile)
Response.WriteFile(strFile)
Response.Flush()
Response.End()
End If

All is quite well with Firefox and with a lot of tested IE's. The PDF opens
direct in the popup. But on some machines only a blank window opens for a
short time and disapears immediatly. After a lot of testing, I saw, if I
check in IE under Security - Custom Level - "Download" - "Automatic
prompting for file downloads" that IE asks now if it should download a file
called "Report.pdf". If I click "OK", I can save the file to a choosen
location and can open it with Acrobat.

Normaly, the Form has NOT the name Report.pdf. It's called <someGUID>.pdf.
Report.aspx is only the name of the forms container in which the file is
written.

Does someone know a solution?

Thanks
Hans
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top