0 Replies Latest reply on Sep 24, 2014 12:47 PM by lgoolsby

    Reader 11 does not render PDF's in IE on Win7 32-bit, works on Win7 64-bit

    lgoolsby

      I am working on a custom page to render a PDF using the PDFObject JavaScript library.

       

      This page works fine for everything we have tested except for Win7 32 bit. When we access the page on a Win7 32-bit machine with Reader 11.x installed Reader does not render the PDF. However it does render the PDF if Reader is downgraded to 10.x.


      The code seems to work fine for all other versions of IE and Reader 11.x that run on a 64-bit OS.

       

      Anyone have an idea of what might cause the 32-bit Win7/Reader 11.x combination to not work? There is an error thrown in "new PDFObject()" declaration but the error does not have any details in the exception object.

       

      My code for those that are curious. This is rendered in an iFrame hence why its a bit spartan.

       

      <html>
      <head>
          <meta name="WebPartPageExpansion" content="full" />
          <script type="text/javascript" src="/_catalogs/masterpage/Display Templates/Custom/pdfobject.js"></script>
          <link rel="stylesheet" type="text/css" href="/_layouts/15/1033/styles/Themable/corev15.css" />
          <style type="text/css">
              #pdfContainer{
              }
              #pdfContainer.embedded{
                  width: 100%;
                  min-height: 500px;
                  vertical-align:middle;
              }
              #pdfContainer object{
                  display:block;
              }
          </style>
      </head>
      <body>
          <div style="min-height: 500px; width: 100%; vertical-align: middle" id="pdfContainer">
                  <p style="visibility:hidden" id="pdfError">
                      Unable to find Adobe Reader, click the 'Get Adobe Reader' button below to install the Adobe Reader.
        <br />
                      <br />
                      <a href='http://get.adobe.com/reader/'>
                          <img src='/_catalogs/masterpage/Display Templates/Custom/get_adobe_reader.gif' alt='Get Adobe Reader' />
                      </a>
                      <br />
                  </p>
          </div>
          <script type="text/javascript">
              function getParameterByName(name) {
                  name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
                  var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
                      results = regex.exec(location.search);
                  return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
              };
      
              window.onload = function () {
                  var errorMsg = document.getElementById("pdfError");
                  var pdfPath = getParameterByName("pdfPath");
      
                  var pdfObject;
                  try {
                      pdfObject = new PDFObject({
                          url: pdfPath,
                          id: "ffPdf",
                          pdfOpenParams: {
                              navpanes: 0,
                              toolbar: 0,
                              statusbar: 0,
                              view: "Fit"
                          }
                      });
                  }
                  catch (e) {
                      console.info(e)
                  }
      
                  if (pdfObject) {
                      document.getElementById("pdfContainer").className = "embedded";
                      var htmlObj = pdfObject.embed("pdfContainer");
                  }
                  else {
                      errorMsg.style.visibility = "visible";
                  }
              };
          </script>
      </body>
      </html>