473,799 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="VBScr ipt" %>
<% 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:\I ncomingChequesS cans\"
strSecLevel=ses sion("seclevel" )
strSecSubLevel= session("secsub level")
RecID=Request.Q ueryString("id" )

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

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

Set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadF romFile strFilePath

Response.Binary Write objStream.Read

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

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

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

<script language=Javasc ript>
function OpenCheque(cheq ueNum)
{
window.open('Ge tCheque.asp?Rec ID=' + chequeNum,'neww in','height=200 ,
width=500, top=200, left=200');
}
</script>

<a href="Javascrip t: OpenCheque('211 2');">View Cheque 2112</a>
TomB

"Paul Eaton" <pe****@pt.lu > wrote in message
news:13******** *************** ***@posting.goo gle.com...
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="VBScr ipt" %>
<% 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:\I ncomingChequesS cans\"
strSecLevel=ses sion("seclevel" )
strSecSubLevel= session("secsub level")
RecID=Request.Q ueryString("id" )

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

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

Set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadF romFile strFilePath

Response.Binary Write 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.goo gle.com...
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="VBScr ipt" %>
<% 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:\I ncomingChequesS cans\"
strSecLevel=ses sion("seclevel" )
strSecSubLevel= session("secsub level")
RecID=Request.Q ueryString("id" )

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

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

Set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadF romFile strFilePath

Response.Binary Write 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="ViewIm age('<% =RecID %>')">
As I don't think I can put a 'target'in:-

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

Regards
Paul


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

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

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

<script language=Javasc ript>
function OpenCheque(cheq ueNum)
{
window.open('Ge tCheque.asp?Rec ID=' + chequeNum,'neww in','height=200 ,
width=500, top=200, left=200');
}
</script>

<a href="Javascrip t: OpenCheque('211 2');">View Cheque 2112</a>
TomB

"Paul Eaton" <pe****@pt.lu > wrote in message
news:13******** *************** ***@posting.goo gle.com...
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="VBScr ipt" %>
<% 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:\I ncomingChequesS cans\"
strSecLevel=ses sion("seclevel" )
strSecSubLevel= session("secsub level")
RecID=Request.Q ueryString("id" )

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

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

Set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadF romFile strFilePath

Response.Binary Write objStream.Read

objStream.Close
Set objStream = Nothing
%>

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

<input type=button value="View Image"
onClick=
"window.open('. ./GCS/GCxxx.asp?id=<% =RecID%>&mode=v iew')">
--
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
13250
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
3355
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? The following page2.asp won't output the value entered in page1.asp. However, if we do <form action="page2.asp" method="get" target="_blank">, then it will open a new window for the request page, instead of using the same window as page1.asp....
29
5033
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 window properly but does not pass the parameter. (this is part of a coldfusion template) <a href="##"
3
1637
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 specify the URL in server side.??? Million thanks -- Best Regards,
4
1805
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 each open window even/especially for child windows in other non managed mdi apps - if excel has 3 books open or any other mdi app has several windows open, I'd like the complete text from each window. The current solution gives me more info...
1
3657
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 ("javascript:void(window.open('http://www.onePage.com','popwindow','status=y es,scrollbars=yes,width=800,height=450,resizable=yes'))"); this works perfect always, but now when the page is inside a frame it doesn't work, doing nothing.
2
1635
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. I have a local HTML file, where I have some kind of link. When this
1
1704
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 <script language=javascript> function open_win(url_add) { window.open(url_add,'','width=800,height=650' }
1
7392
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 given below function poponload(strs) { var path="d:/files/hello.pdf"; testwindow= window.open (""+path+"", "mywindow","location=0,status=0,scrollbars=1,toolbar=no,resizable=yes,width=500,height=500"); testwindow.moveTo(0,0);
1
2459
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 relative the second with position absolute so the second is placed under the container. I want to put my javascript open.window using top left height width according to the user's screen measurements. I use percentage so it is relative easy to...
0
9686
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9540
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10475
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10250
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.