• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

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)

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

  • 2
  • 2
1 Solution
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 ..
Sample code on how to open a pdf file to a new browser window via javascript and code behind.

Open .pdf file through the browser
As I understand, even that would open the pdf file in its own exe and not within the browser window ..
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now