title: ABCpdf copy header and footer
body: <p>I'm using ABCpdf 9.1 x64 .Net with Coldfusion to create PDF's based on HTML content. Each PDF document has a different header and footer which are generated as HTML with some Coldfusion code. The header is identical for every page where the footer is slightly different for every page (because it shows the page number). Here's the main part of my code:</p>
  
  <pre><code>// add content
  theDoc.Get_Rect().Set_String("67 80 573 742");
  theContentID = theDoc.AddImageHTML(pdfContent);
  
  while (true) {
      if (!theDoc.Chainable(theContentID)) {
          break;
      }
      theDoc.Set_Page(theDoc.AddPage());
      theContentID = theDoc.AddImageToChain(theContentID);
  }
  
  // add header &amp; footer on each page
  for (i=1; i &lt;= theDoc.Get_PageCount(); i++) {
      // set page
      theDoc.Set_PageNumber(i);
  
      // HEADER
      theDoc.Get_Rect().Set_String("67 755 573 809");
      theDoc.AddImageHTML(headerContent);
  
      // FOOTER
      theDoc.Get_Rect().Set_String("67 0 573 65");
      theDoc.AddImageHTML(replace(footerContent, "[page]", i));
  }
  </code></pre>
  
  <p>As you can see, the <code>AddImageHTML()</code> method gets called 2 times for every page and once for the content. So if I have content which creates 6 pages, the method gets called 13 times. This isn't ideal because the method consums a lot of time.</p>
  
  <p>Is there a more efficient way to add a header and footer from HTML? There's a method <code>AddImageCopy()</code> but it doesn't work with objects created by <code>AddImageHtml()</code> .</p>
  
  <p>Just for understandig: Those getter and setter methods are created by Coldfusion to access .Net properties.</p>