Link to home
Start Free TrialLog in
Avatar of macros14
macros14

asked on

PDF Open new window?

I finally got my application to work where on a blank page a pdf will open (the pdf is being brought out of a database as a ole object).  The only problem I have having now is the fact that it opens in a acrobat window and leaves the ie window blank, so you have two windows open.  How can I make it open within IE??

Here is my code.

If rd.Read() Then

                    Dim filename As String
                    Dim filesize As Integer
                    Dim contenttype As String

                    filename = rd.GetString(0)
                    filesize = rd.GetInt32(1)
                    contenttype = rd.GetString(2)

                    Dim filedata(filesize) As Byte

                    rd.GetBytes(3, 0, filedata, 0, filesize)

                    Response.Clear()
                    If (forceDownload) Then
                        Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename)
                    Else
                        Response.AppendHeader("Content-Disposition", "inline; filename=" + filename)
                    End If
                    Response.ContentType = contenttype
                    Response.OutputStream.Write(filedata, 0, filedata.Length)
                End If

                rd.Close()
                con.Close()
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

pdf cannot be opened with IE, unless u get some activex control which wil can add within the form and which inturn will open the pdf file within it ...
how the pdf file should behave is configured in ur PC,
open explorer ..
in the menu tool->option->file types tab
seelct the pdf type .. click on advanced button .. u will see that "Open in the same window" is disabled .. if this was enabled, u could check it and then ur pdf will open in the same window as IE ..
ASKER CERTIFIED SOLUTION
Avatar of ihenry
ihenry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As I understand, even that would open the pdf file in its own exe and not within the browser window ..
Avatar of ihenry
ihenry

@Rejojohny,
I promise you, if you try the code you will see a pdf file inside your browser:o) It is so called browser's plug-in capability