Loading a pdf file into iframe.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Control Freq

    Loading a pdf file into iframe.

    Hi,
    Confused about loading a pdf file into an iframe from C# code behind.

    I have a PDF file called temp2.pdf in my document root. The file is
    physically located at C:\inetpub\wwwr oot\MySite\temp 2.pdf .

    In the code behind I try:

    Iframe1.Attribu tes.Add("src", "\\MySite\\temp 2.pdf"); // THIS WORKS
    Iframe1.Attribu tes.Add("src",
    "c:\\inetpub\\w wwroot\\MySite\ \temp2.pdf"); // NOT WORK.
    Iframe1.Attribu tes.Add("src", "c:\\Any\\Other \\Directory\\te mp2.pdf");
    // NOT WORK.

    Ideally I would like to put the PDF documents below some 'well known'
    reports folder, such as C:\\Data\\Repor ts\\blah but I can't get it to
    work.

    Please help.

    Regards

  • Hans Kesting

    #2
    Re: Loading a pdf file into iframe.

    Hi,
    Confused about loading a pdf file into an iframe from C# code behind.
    >
    I have a PDF file called temp2.pdf in my document root. The file is
    physically located at C:\inetpub\wwwr oot\MySite\temp 2.pdf .
    >
    In the code behind I try:
    >
    Iframe1.Attribu tes.Add("src", "\\MySite\\temp 2.pdf"); // THIS WORKS
    Iframe1.Attribu tes.Add("src",
    "c:\\inetpub\\w wwroot\\MySite\ \temp2.pdf"); // NOT WORK.
    Iframe1.Attribu tes.Add("src", "c:\\Any\\Other \\Directory\\te mp2.pdf");
    // NOT WORK.
    >
    Ideally I would like to put the PDF documents below some 'well known'
    reports folder, such as C:\\Data\\Repor ts\\blah but I can't get it to
    work.
    >
    Please help.
    >
    Regards
    The browser has to be able to get at that file, by way of IIS. If the
    directory where the PDFs are is outside of the website, IIS can't serve
    it to the browser.
    So either place those files insite the website directory (maybe in a
    subdirectory of your choice), OR add some "upload.asp x" to your site
    that can get the PDF file from it's directory elsewhere and pass it on
    to the browser (see Response.WriteF ile)

    Hans Kesting


    Comment

    Working...