473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Open PDF in new window

Hi

I am developing my first asp appication (vbscript). I am storing
cheques scans (in pdf format) in the file system along with the db on
the server.

The following code is working without problem except that:-

I want to display the scan/pdf in a new window and keep the current
window at the current position within the application.

Thanks in advance if you can spare the time to show me the best way to
do this.

Paul

(peaton at franklin templeton d.o.t com (with no _))

<%@ Language="VBScript" %>
<% Option Explicit %>
<% response.buffer = true %>
<%
'On Error Resume Next
Const adTypeBinary = 1
Dim strFilePath

Dim RecID
Dim ImagePath
Dim strSecLevel
Dim strSecSubLevel
Dim objStream

ImagePath="e:\IncomingChequesScans\"
strSecLevel=session("seclevel")
strSecSubLevel=session("secsublevel")
RecID=Request.QueryString("id")

'Set the content type to the specific type that you are sending.
Response.ContentType = "seclevel/pdf"

strFilePath = ImagePath & RecID & ".pdf" 'This is the path to the file
on disk.

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

Response.BinaryWrite objStream.Read

objStream.Close
Set objStream = Nothing
%>
Jul 19 '05 #1
4 33470
Add a target to your link on the first page

<a href="GetCheque.asp?RecID=2112" target="_new">View Cheque 2112</a>

OR, use the javascript window.open to specify formatting options

<script language=Javascript>
function OpenCheque(chequeNum)
{
window.open('GetCheque.asp?RecID=' + chequeNum,'newwin','height=200,
width=500, top=200, left=200');
}
</script>

<a href="javascript: OpenCheque('2112');">View Cheque 2112</a>
TomB

"Paul Eaton" <pe****@pt.lu> wrote in message
news:13**************************@posting.google.c om...
Hi

I am developing my first asp appication (vbscript). I am storing
cheques scans (in pdf format) in the file system along with the db on
the server.

The following code is working without problem except that:-

I want to display the scan/pdf in a new window and keep the current
window at the current position within the application.

Thanks in advance if you can spare the time to show me the best way to
do this.

Paul

(peaton at franklin templeton d.o.t com (with no _))

<%@ Language="VBScript" %>
<% Option Explicit %>
<% response.buffer = true %>
<%
'On Error Resume Next
Const adTypeBinary = 1
Dim strFilePath

Dim RecID
Dim ImagePath
Dim strSecLevel
Dim strSecSubLevel
Dim objStream

ImagePath="e:\IncomingChequesScans\"
strSecLevel=session("seclevel")
strSecSubLevel=session("secsublevel")
RecID=Request.QueryString("id")

'Set the content type to the specific type that you are sending.
Response.ContentType = "seclevel/pdf"

strFilePath = ImagePath & RecID & ".pdf" 'This is the path to the file
on disk.

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

Response.BinaryWrite objStream.Read

objStream.Close
Set objStream = Nothing
%>

Jul 19 '05 #2
I guess you are clicking on something to pop this up? in that case, on this
link add the target="_Blank" line and javascript window.open call.

As ASP is server side, it can not open a new browser window on your users
machine.

Stuart Palmer

"Paul Eaton" <pe****@pt.lu> wrote in message
news:13**************************@posting.google.c om...
Hi

I am developing my first asp appication (vbscript). I am storing
cheques scans (in pdf format) in the file system along with the db on
the server.

The following code is working without problem except that:-

I want to display the scan/pdf in a new window and keep the current
window at the current position within the application.

Thanks in advance if you can spare the time to show me the best way to
do this.

Paul

(peaton at franklin templeton d.o.t com (with no _))

<%@ Language="VBScript" %>
<% Option Explicit %>
<% response.buffer = true %>
<%
'On Error Resume Next
Const adTypeBinary = 1
Dim strFilePath

Dim RecID
Dim ImagePath
Dim strSecLevel
Dim strSecSubLevel
Dim objStream

ImagePath="e:\IncomingChequesScans\"
strSecLevel=session("seclevel")
strSecSubLevel=session("secsublevel")
RecID=Request.QueryString("id")

'Set the content type to the specific type that you are sending.
Response.ContentType = "seclevel/pdf"

strFilePath = ImagePath & RecID & ".pdf" 'This is the path to the file
on disk.

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

Response.BinaryWrite objStream.Read

objStream.Close
Set objStream = Nothing
%>

Jul 19 '05 #3
Thankyou for the responses

I have used the window.open version in a JScript function
'ViewImage':-

<input type=button value="View Image" name=Image1
onClick="ViewImage('<% =RecID %>')">
As I don't think I can put a 'target'in:-

<input type=button value="View Image" name=Image1
onClick="location.href='../GCS/GCSImageView.asp?id=<% =RecID
%>&mode=view'">

Regards
Paul


"Tom B" <sh*****@hotmail.com> wrote in message news:<#p**************@TK2MSFTNGP10.phx.gbl>...
Add a target to your link on the first page

<a href="GetCheque.asp?RecID=2112" target="_new">View Cheque 2112</a>

OR, use the javascript window.open to specify formatting options

<script language=Javascript>
function OpenCheque(chequeNum)
{
window.open('GetCheque.asp?RecID=' + chequeNum,'newwin','height=200,
width=500, top=200, left=200');
}
</script>

<a href="javascript: OpenCheque('2112');">View Cheque 2112</a>
TomB

"Paul Eaton" <pe****@pt.lu> wrote in message
news:13**************************@posting.google.c om...
Hi

I am developing my first asp appication (vbscript). I am storing
cheques scans (in pdf format) in the file system along with the db on
the server.

The following code is working without problem except that:-

I want to display the scan/pdf in a new window and keep the current
window at the current position within the application.

Thanks in advance if you can spare the time to show me the best way to
do this.

Paul

(peaton at franklin templeton d.o.t com (with no _))

<%@ Language="VBScript" %>
<% Option Explicit %>
<% response.buffer = true %>
<%
'On Error Resume Next
Const adTypeBinary = 1
Dim strFilePath

Dim RecID
Dim ImagePath
Dim strSecLevel
Dim strSecSubLevel
Dim objStream

ImagePath="e:\IncomingChequesScans\"
strSecLevel=session("seclevel")
strSecSubLevel=session("secsublevel")
RecID=Request.QueryString("id")

'Set the content type to the specific type that you are sending.
Response.ContentType = "seclevel/pdf"

strFilePath = ImagePath & RecID & ".pdf" 'This is the path to the file
on disk.

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

Response.BinaryWrite objStream.Read

objStream.Close
Set objStream = Nothing
%>

Jul 19 '05 #4
Paul Eaton wrote on 09 jul 2003 in microsoft.public.inetserver.asp.general:
<input type=button value="View Image" name=Image1
onClick="location.href='../GCS/GCSImageView.asp?id=<% =RecID
%>&mode=view'">

<input type=button value="View Image"
onClick=
"window.open('../GCS/GCxxx.asp?id=<%=RecID%>&mode=view')">
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ben | last post by:
Hi there, in a form, here's what I want to do : <input type=button onclick= (???) is it possible to open a pop-up window with a specified url without using javascript ? Thanks
1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
3
by: Grey | last post by:
I know I need to use client side script to open new window, window.open("URL"). However, the URL in the function is dinamically generated by server side. How can I open window in client side, but...
4
by: gabe | last post by:
i have a solution to gather the text in each window that is open, but would rather use only managed code rather than unmanaged code my current solution relies on. The purpose is to get the text in...
1
by: Alejandro Vidal | last post by:
Hi, I have a curius problem, I hava a flash in a html page. In flash I have a button to open a pop up with this code: getURL...
2
by: Martin Mosbęk Christiansen | last post by:
Hi I have been searching this group but I haven't found anything I can use... Is it possible to remote modify an already open window form from a local HTML file? Example (simplified): 1....
1
by: peerraghu | last post by:
hi i am creating travels project using .net and c# and iam new to java scripts i want to open new window with in the same page after clicking the image i have wreiten code just look at this ...
1
mageswar005
by: mageswar005 | last post by:
Hello, In My Application i have open the PDF file from javascript open.window function.In This scenario i want to control / Hide the PDF Toolbar from open.window function. My Current code is...
1
by: hcoulange | last post by:
I am trying to open a window inside a DIV or a table cell. In the stylesheet I put a #container and a #jx, In my page I have first a div id=container and another DIV call jx the first with position...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.