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....
Printable View
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....
I'm interested in making this happen. Did you ever solve this issue?
Corinne
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
I was looking a code like that, but my file is on a server or on the pc.
Any help?
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.Quote:
Originally Posted by mendhak
Do u mean: Response.Redirect (pathfilename and what?)
Thanks.Quote:
Originally Posted by mendhak
It is works
Nice, add [Resolved] to the thread title.
viewing pdf file
Roflmfao.