title: Export iframe contents as pdf using jquery
body: <p>I have a HTML page with Iframe content and i am trying to export it to PDF.The export to PDF is working but the JS query does not pull the IFrame content into the PDF file. </p>
  
  <p>The <p> tag content alone is been published in pdf file.</p>
  
  <p>Below listed the code for references.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  
  &lt;body&gt;
  
    &lt;div id="content"&gt;
      &lt;p&gt; Hello &lt;/p&gt;
      &lt;iframe src="https://app.powerbi.com/view?r=eyJrIjoiYjVjZTZkYjEtNWRiOC00ZTM2LWJiNGYtZTA0Y2I2YmFhN2Y4IiwidCI6ImJkMGQyNTQxLWEyZTAtNDE1Zi1hNTI2LTNkY2UxODFlMDM0OSIsImMiOjh9" style="height:750px;width:1550px;"&gt;
  &lt;/iframe&gt;
    &lt;/div&gt;
    &lt;div id="editor"&gt;&lt;/div&gt;
    &lt;button id="cmd"&gt;Generate PDF&lt;/button&gt;
  
    &lt;script src="https://code.jquery.com/jquery-1.12.3.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.min.js"&gt;&lt;/script&gt;
  
    &lt;Script&gt;
      var doc = new jsPDF();
      var specialElementHandlers = {
        '#editor': function(element, renderer) {
          return true;
        }
      };
  
      $('#cmd').click(function() {
        doc.fromHTML($('#content').html(), 50, 50, {
          'width': 170,
          'height': 170,
          'elementHandlers': specialElementHandlers
        });
        doc.save('sample-file.pdf');
      });
  
      function getFrameContents() {
        var iFrame = document.getElementById('#content');
        var iFrameBody;
        if (iFrame.contentDocument) { // FF
          iFrameBody = iFrame.contentDocument.getElementsByTagName('#content')[1];
        } else if (iFrame.contentWindow) { // IE
          iFrameBody = iFrame.contentWindow.document.getElementsByTagName('#content')[1];
        }
        //alert(iFrameBody.innerHTML);
        return iFrameBody.innerHTML
      }
    &lt;/Script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>