title: Coldfusion cfdocument pdf conversion javascript not working
body: <p>I have a <code>_reports_full.cfm</code> file which has all the html and also have a small javascript which then renders the page numbers on each page and also calculates page total and displays that. Also, the converted pdf is then emailed as an attachment. Now, I have cfdocument like this </p>
  
  <pre><code>&lt;cfdocument format="pdf"
      backgroundvisible="yes"
      orientation="#URL.orientation#"
      marginLeft="0.25" marginRight="0.25"
      marginTop="0"
      saveAsName = "PDFGenerator.pdf"
      marginBottom="0"
      fontEmbed="false"
      pageType="letter" pageWidth="8" pageHeight="11" unit="in" localurl="yes"&gt;
          &lt;cfset num = 1&gt;
              &lt;cfloop index="i" list="#theCode#" delimiters="|||"&gt;
                  &lt;cfif num GT 1&gt;
                      &lt;cfdocumentitem type = "pagebreak"/&gt;
                  &lt;/cfif&gt;
              #i#
              &lt;cfset num = num + 1&gt;
              &lt;/cfloop&gt;
      &lt;/cfdocument&gt;
  </code></pre>
  
  <p>Variable <code>theCode</code> is a <code>cfhttp.fileContent</code> to the url for this <code>_reports_full.cfm</code> file. </p>
  
  <p>And Javascript code is below which is also included in _reports.full.cfm,</p>
  
  <pre><code>&lt;SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"&gt;
      document.getElementById("p1").innerHTML = document.getElementById("pageCnt").value;
      document.getElementById("p2").innerHTML = document.getElementById("pageCnt").value;
      if (document.getElementById("p3")) document.getElementById("p3").innerHTML = document.getElementById("pageCnt").value;
      if (document.getElementById("p4")) document.getElementById("p4").innerHTML = document.getElementById("pageCnt").value;
      if (document.getElementById("p5")) document.getElementById("p5").innerHTML = document.getElementById("pageCnt").value;
      if (document.getElementById("p6")) document.getElementById("p6").innerHTML = document.getElementById("pageCnt").value;
      if (document.getElementById("p7")) document.getElementById("p7").innerHTML = document.getElementById("pageCnt").value;
  &lt;/SCRIPT&gt;
  </code></pre>
  
  <p>I am able to see the page numbers and total in browser(I have 2 options in my application, one is to view the printable in browser and other is to email it in pdf and html format, now I should mention that html formatted email also doesn't display the page numbers or total).
  Can someone please help. Thanks in advance.</p>