|
-
Feb 6th, 2003, 11:45 AM
#1
Thread Starter
Frenzied Member
viewing pdf file
I would like to view a .pdf file from my web page. The .pdf is in an Oracle db...anyone have some sample code or a link that will be useful....
Last edited by EyeTalion; Feb 6th, 2003 at 03:13 PM.
-
Oct 1st, 2004, 11:05 AM
#2
Lively Member
View PDF
I'm interested in making this happen. Did you ever solve this issue?
Corinne
-
Oct 4th, 2004, 07:59 AM
#3
Thread Starter
Frenzied Member
This is for a pdf that is stored in an Oracle database...hope this helps.
VB Code:
Private Sub btnPdf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPdf.Click
Dim userid As String
Dim password As String
Dim database As String
userid = Session("username")
password = Session("password")
database = Session("database")
BidId = txtBidId.Text
Dim strConn As String = "Provider=OraOLEDB.Oracle;Persist Security Info=False;User ID=" & userid & ";Password=" & password & "; Data Sour" & _
"ce=" & database & ";Extended Properties="""""
Dim strSQL As String = "select bid_document from PBSS.pbss_bid where bid_id ='" & BidId & "'"
Dim objConn As New OleDbConnection(strConn)
Dim objComm As New OleDbCommand(strSQL, objConn)
Dim objDR As OleDbDataReader
objConn.Open()
objDR = objComm.ExecuteReader
Try
Do While objDR.Read = True
Dim pdf As String = "bid_package.pdf"
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "inline;filename=" & Trim(pdf))
Response.BinaryWrite(objDR("bid_document"))
Response.Flush()
Response.End()
Loop
Catch es As Exception
lblerr.Text = ""
lblerr.Text = (Err.Description)
objDR.Close()
objConn.Close()
Exit Sub
End Try
objDR.Close()
objConn.Close()
If txtBidId.Text = "" Then
lblerr.Text = "You must select a Bid from the " & "<a href=updatelist.aspx>Update Table</a>"
End If
End Sub
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Feb 9th, 2006, 11:35 AM
#4
Fanatic Member
Re: viewing pdf file
I was looking a code like that, but my file is on a server or on the pc.
Any help?
-
Feb 9th, 2006, 11:40 AM
#5
Re: viewing pdf file
Do you have a way of determining whether it's on the server or pc? If it's on the server, a simple Resonse.Redirect to the PDF will do. If it's on the pc, use javascript's document.location.href
-
Feb 9th, 2006, 12:25 PM
#6
Fanatic Member
Re: viewing pdf file
 Originally Posted by mendhak
Do you have a way of determining whether it's on the server or pc? If it's on the server, a simple Resonse.Redirect to the PDF will do. If it's on the pc, use javascript's document.location.href
Yes, i know where the docs are.
Do u mean: Response.Redirect (pathfilename and what?)
-
Feb 9th, 2006, 01:45 PM
#7
Fanatic Member
Re: viewing pdf file
 Originally Posted by mendhak
Do you have a way of determining whether it's on the server or pc? If it's on the server, a simple Resonse.Redirect to the PDF will do. If it's on the pc, use javascript's document.location.href
Thanks.
It is works
-
Feb 10th, 2006, 05:32 AM
#8
Re: viewing pdf file
Nice, add [Resolved] to the thread title.
-
Feb 13th, 2006, 10:20 AM
#9
Fanatic Member
[Resolved]: viewing pdf file
-
Feb 14th, 2006, 05:10 AM
#10
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|