ABCpdf copy header and footer

I am using ABCpdf 9.1 x64.Net with Coldfusion to create PDF based on HTML content. Each PDF has different headers and footers that are generated as HTML with some Coldfusion code. The title is identical for each page, where the footer is slightly different for each page (since it shows the page number). Here is the main part of my 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 & footer on each page
for (i=1; i <= 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));
}

As you can see, the method AddImageHTML()is called 2 times for each page and once for the content. Therefore, if I have content that creates 6 pages, the method gets 13 times. This is not ideal because the method is time consuming.

HTML? AddImageCopy(), , AddImageHTML().

: getter setter Coldfusion .Net.

+3
2
  • HTML CSS, HTML- AddHtml AddImageHtml. AddHtml , AddImageHtml. ( ) CMYK, .

  • , , AddImageHtml Doc, . .

  • , , - .

+1

,

doc.PageNumber = 1;
doc.Rect.Rectangle = headerRect; //headerrect should define the rect where the header is
doc.AddImageHtml(headerHtml);  //perform addimage html once

//repeat for other pages (clones the header. much faster than calling addImageHtml every time)
 for (int i = 1; i <= doc.PageCount; i++)
  {
    doc.PageNumber = i;
        doc.AddImageDoc(doc, 1, doc.Rect);
   }
0