Results 1 to 10 of 10

Thread: viewing pdf file

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    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.

  2. #2
    Lively Member
    Join Date
    Jul 2003
    Posts
    93

    View PDF

    I'm interested in making this happen. Did you ever solve this issue?

    Corinne

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    This is for a pdf that is stored in an Oracle database...hope this helps.

    VB Code:
    1. Private Sub btnPdf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPdf.Click
    2.         Dim userid As String
    3.         Dim password As String
    4.         Dim database As String
    5.         userid = Session("username")
    6.         password = Session("password")
    7.         database = Session("database")
    8.         BidId = txtBidId.Text
    9.        
    10.         Dim strConn As String = "Provider=OraOLEDB.Oracle;Persist Security Info=False;User ID=" & userid & ";Password=" & password & "; Data Sour" & _
    11.                             "ce=" & database & ";Extended Properties="""""
    12.         Dim strSQL As String = "select bid_document from PBSS.pbss_bid where bid_id ='" & BidId & "'"
    13.         Dim objConn As New OleDbConnection(strConn)
    14.         Dim objComm As New OleDbCommand(strSQL, objConn)
    15.         Dim objDR As OleDbDataReader
    16.         objConn.Open()
    17.         objDR = objComm.ExecuteReader
    18.        
    19.         Try
    20.             Do While objDR.Read = True
    21.                 Dim pdf As String = "bid_package.pdf"
    22.                 Response.Clear()
    23.                 Response.ContentType = "application/octet-stream"
    24.                 Response.AddHeader("Content-Disposition", "inline;filename=" & Trim(pdf))
    25.                 Response.BinaryWrite(objDR("bid_document"))
    26.                 Response.Flush()
    27.                 Response.End()
    28.             Loop
    29.         Catch es As Exception
    30.             lblerr.Text = ""
    31.             lblerr.Text = (Err.Description)
    32.             objDR.Close()
    33.             objConn.Close()
    34.             Exit Sub
    35.         End Try
    36.         objDR.Close()
    37.         objConn.Close()
    38.         If txtBidId.Text = "" Then
    39.             lblerr.Text = "You must select a Bid from the  " & "<a href=updatelist.aspx>Update Table</a>"
    40.         End If
    41.     End Sub
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  4. #4
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    Re: viewing pdf file

    I was looking a code like that, but my file is on a server or on the pc.

    Any help?

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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

  6. #6
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    Re: viewing pdf file

    Quote 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?)

  7. #7
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    Re: viewing pdf file

    Quote 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

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: viewing pdf file

    Nice, add [Resolved] to the thread title.

  9. #9
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    [Resolved]: viewing pdf file

    viewing pdf file

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: viewing pdf file

    Roflmfao.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width