• 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)

                    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()
0
macros14
Asked:
macros14
  • 2
  • 2
1 Solution
 
RejojohnyCommented:
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 ..
0
 
ihenryCommented:
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
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21102451.html
0
 
RejojohnyCommented:
As I understand, even that would open the pdf file in its own exe and not within the browser window ..
0
 
ihenryCommented:
@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
0

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