Open .pdf/.doc file

Last post 10-29-2007 7:11 AM by sandeepthekka. 8 replies.

Sort Posts:

  • Open .pdf/.doc file

    06-11-2004, 3:35 PM
    • Member
      615 point Member
    • wvusriram
    • Member since 03-20-2003, 11:09 AM
    • Posts 123
    Can someone help me in opening a .pdf/.doc file on the browser using asp.net.
    I tried searching but couldnt find some to look up on this topic.


    Thanks,

    -sriram
  • Re: Open .pdf/.doc file

    06-11-2004, 6:12 PM
    • Member
      200 point Member
    • narayanan1982
    • Member since 05-26-2004, 11:22 AM
    • Posts 40
    I assume that you have successfully uploaded the document into the DB during which you have created a unique docID for each document.
    To view in a browser,
    Say you have a hyperlink with text set as the title of the document. When you click it a window opens the doc.
    For this,
    Bind the hyperlink to the document's name (from the DB) and also retrieve the unique ID in the dataset. Then set the navigateurl propery to direct it to another page using this uniqueID as say a querystring. So while another window open up you have passed the particular document's unique ID also.
    Next,
    retrieve the document blob fom the database and add header field to if needed using the AppendHeader property.
    Finally,
    do a Response.BinaryWrite of this blob on the new page that has opened.
    regards
  • Re: Open .pdf/.doc file

    06-11-2004, 6:37 PM
    • Contributor
      4,570 point Contributor
    • danmor
    • Member since 11-04-2002, 9:48 PM
    • Bellevue, WA
    • Posts 910
    • AspNetTeam
    This is not a feature of ASP.NET. It is a feature of the client's browser. If the browser supports the ActiveX object that hosts PDF or DOC then all you need is a tag with a link to the document, something like <iframe src="mydoc.doc"></iframe>.
    -Dan
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Open .pdf/.doc file

    06-13-2004, 2:37 PM
    • Member
      615 point Member
    • wvusriram
    • Member since 03-20-2003, 11:09 AM
    • Posts 123
    Actually, i have my word files in a folder. I want to open these files on asp.net.

    I dont have anything to do with the database. So i just want to open a file in the HD thru asp.net application.

    So what should i do???

    Can u give some links where i can find examples for the iframe u said that could help me in opening a word file.


    Thanks for your reply.
  • Re: Open .pdf/.doc file

    06-14-2004, 1:20 PM
    • Contributor
      4,570 point Contributor
    • danmor
    • Member since 11-04-2002, 9:48 PM
    • Bellevue, WA
    • Posts 910
    • AspNetTeam
    If you have the documents in a folder, then there is nothing tricky about it.

    <iframe src="document.doc" width="300" height="300"></iframe>

    You can adjust the width and height or leave them out completely. Keep in mind that not everyone will see the page the same way. Not all browsers support doc and pdf files inside the browser. Users can also choose to deny doc and pdf opening inside the browser, even if they have both Word and Acrobat Reader installed.
    -Dan
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Open .pdf/.doc file

    06-14-2004, 10:38 PM
    • Member
      615 point Member
    • wvusriram
    • Member since 03-20-2003, 11:09 AM
    • Posts 123
    Thanks. I can open the word file using iframe.

    But i was wondering as how to enable the tool bar so that the user can save the file as a word file on to his system.


    once again thanks for helping
  • Re: Open .pdf/.doc file

    06-14-2004, 11:36 PM
    • Contributor
      4,570 point Contributor
    • danmor
    • Member since 11-04-2002, 9:48 PM
    • Bellevue, WA
    • Posts 910
    • AspNetTeam
    I can think of two things. One, you can just insert a hyperlink to the DOC file (myfile.doc) in your HTML, and tell the user to right-click on the link and choose Save Target As. Or you could just display the document, instead of putting it into an iFrame. That means instead of creating an ASPX page with an iFrame you link to the actual myFile.doc. That way the File Save As will save the file as a Word document locally. I don't know any toolbar tricks.
    -Dan
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Open .pdf/.doc file

    10-28-2007, 10:31 PM
    • Member
      2 point Member
    • Arumugam
    • Member since 10-24-2007, 12:37 PM
    • Posts 1

    Hi,

           If u can send me u r mail id to this info.six84@gmail.com i wil send u some samples..

    Regards,

    Arumugam.N

  • Re: Open .pdf/.doc file

    10-29-2007, 7:11 AM
    • Member
      562 point Member
    • sandeepthekka
    • Member since 10-23-2007, 2:53 AM
    • kerala
    • Posts 164

    u can make use of <object tag> to open a pdf in asp.net.....

    or simply click the hyperlink which points to a pdf file....

    <a href="Downloads/voice2007.pdf">

Page 1 of 1 (9 items)