Skip to main content
Participant
April 13, 2017
Question

Why can't I embed the pdf in my web page anymore

  • April 13, 2017
  • 1 reply
  • 7794 views

For weeks I have been using:

        pdfParam = "search="" + searchString + ""&toolbar=0&messages=0&navpanes=0&view=Fit";        

        url = url + "#" + Server.UrlPathEncode( pdfParam );                 

         if ( openType == "OpenOnPage" )           

         {           

             var x = GetPDF( GetPDFDiv() );           

             x.Text = "<object " +                       

                           "class=\"Object\" " +                       

                           "width=\"100%\" " +                       

                           "height=\"980x\" " + 

                          "type=\"application/x-pdf\" " +                       

                          "data=\"" + url + "\" " +                       

                          "> " +                      "

                         This browser does not support embedded PDFs. Click here to view it.         couldn't figure out to put html text in here

              ShowPDF();           

         }

Today, the PDF showed for a moment, and then an error from PDF said the "Adobe PDF Reader DC stopped working".  I was able to remove the pdfParams and then it showed ok, but the main thing I was trying to accomplish was search for a string so that the pdf was positioned to it.

So then I uninstalled the Reader and downloaded and installed the latest one.  Now I get the "This browser doesn't support..." message and it doesn't show in the page at all.  If I switch it to using an iframe, it shows, but I don't know how to use the parameters with an iframe.

This is on

   Windows 10 - Creators Update

   IE 11.0.15063.0   update versions 11.40

   Adobe Acrobat Reader DC 17.009.20044

    This topic has been closed for replies.

    1 reply

    ~graffiti
    Legend
    April 13, 2017

    Embedding a pdf on-page is a bad idea these days. Many (going on most) browsers do not even use the Adobe Reader plug-in any more. They use their own viewer. Your success may vary from one person and pdf to the other.

    Participant
    April 13, 2017

    I'm aware of all that.  It wasn't my choice to do it.  It is my job to make it work.  Which is why I asked the question.

    April 14, 2017

    Ok, I finally figured out how this broke.  At some point, I added my localhost to Compatibility view to solve some problem.  That worked fine for that problem, but meant the browser was running in IE 5 mode.  Apparently IE 5 didn't like the <object> tag.

    I finally spotted it when running under F12 debugger.  I suddenly noticed a "5" up in the upper right hand corner.  When I popped the list, I saw all the versions from 11 down to 5 as selections.  I select 11 and then my page worked.  Then I left the debugger, ran it again a little later and it was broken again.  The reason being that my localhost was still in the Compatibility view of IE5.

    So I removed localhost from the Compatibility view and now I'm back to a working application again.

    Still have the question of how to get rid of the Search window when there are search parameters and I THINK the PDF Reader will still blow up with the search parameters there.  More fun to be had....


    You can force a page to use the most recent HTML that IE supports by adding the tag:

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />

    into the head area of the page. I'm still using frameset for us, I tried using an object embed but I see the same results.