Display saved PDF file

7 posts, 0 answers
  1. Agm
    Agm avatar
    26 posts
    Member since:
    Sep 2012

    Posted 24 Oct 2013 Link to this post

    Hi,
    I am having a .PDF file which has 2 pages.

    I want to display it directly in webpage.Is there any possible way to do this with telerik.pdf namespace.

    Like reading pdf file using streambytes and display it in webpage.

    please advise me to get this done.

    Thanks in advance.

    Regards,
    AGM Raja
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Oct 2013 Link to this post

    Hi Agm,

    Telerik.PDF namespace is used internally for generating PDF files. Telerik does not provide any control with RadControls for ASP.NET AJAX suit dedicated for viewing PDF files. One suggestion is, If you want to display a PDF file, then you can use a RadWindow as shown below.

    ASPX:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="true" Width="600px" Height="600px">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Open PDF" AutoPostBack="false"
        OnClientClicked="openPdf">

    JavaScript:
    <script type="text/javascript">
        function openPdf(sender, args) {
            window.radopen("FileName.pdf", "RadWindow1");
        }
    </script>

    Thanks,
    Shinu.
  3. Lisa
    Lisa avatar
    1 posts
    Member since:
    Sep 2013

    Posted 25 Oct 2013 Link to this post

    Hi,
    I am also looking for a way to display a pdf file on my web page (along with some other controls). I tried the code you provided but it did not work for me. It opened the window, but the window was blank. In the function I wrote "C:\Development\MyFile.pdf"  in place of "FileName.pdf" because that is the path to a real pdf file on my computer. As I said, a window opens but it does not display the file. At the bottom of the window, it says C:DevelopmentMyFile.pdf - it stripped out the "\"s.
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Oct 2013 Link to this post

    Hi Lisa,

    RadWindow is based on an IFRAME and it behaves just like that. That is why you cannot open a file by its physical path (actually a physical path has \ as a path separator). RadWindow works with URLs and so you need to use an absolute or relative URL to that file on your server. Also make sure to set ShowContentDuringLoad to true - this is needed when opening non-web page files like pdf or doc in RadWindow.

    Hence I suggest you place all the required PDF files inside your project folder and open the files as shown in the following sample.

    JavaScript:
    <script type="text/javascript">
        function openPdf(sender, args) {
            var filelocation = "/Project_Root_Folder/PDF_Files/ORM.pdf";
            window.radopen(filelocation, "RadWindow1");
        }
    </script>

    Thanks,
    Shinu.
  5. Agm
    Agm avatar
    26 posts
    Member since:
    Sep 2012

    Posted 29 Oct 2013 Link to this post

    Hi Shinu,
    I want to open the pdf file in the same browser window not in popup.
    but thanks for the information Telerik does not provide any control for viewing PDF files.

    Thanks again.

    Regards,
    AGM Raja
  6. Rumen
    Admin
    Rumen avatar
    14103 posts

    Posted 29 Oct 2013 Link to this post

    Hi Raja,

    Could you please vote in the following Public Feedback item: PDF viewer for ASP.NET?

    Best regards,
    Rumen
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  7. Suad
    Suad avatar
    2 posts
    Member since:
    Mar 2013

    Posted 21 May 2018 in reply to Shinu Link to this post

    hi Shinu

    <script type="text/javascript">
        function openPdf(sender, args) {
            var filelocation = "/Project_Root_Folder/PDF_Files/ORM.pdf";
            window.radopen(filelocation, "RadWindow1");
        }
    </script>

      I just want to know location of all my PDF is Physical Path --->C:\email_Download\

    In this case          var filelocation = "C:/email_Download//XXX.pdf";

    It does not work Can u suggest ? i am confuse in physical path and relative path

     

Back to Top