Adding and deleting headers and footers from a PDF

You can add a header and footer to a PDF document using the addheader and addfooter actions, as shown in the following snippet:

<!---addfooter---> 
<cfpdf action = "addfooter" 
source = "../myBook.pdf" 
destination = "../myBookwithfooter.pdf" 
image = "adobelogo.JPG" // Use this attribute to add an image in the footer 
align = "right"> // By default, the alignemnt is center 
 
<!---addheader---> 
    <cfpdf action = "addheader" 
    source = "../myBook.pdf" 
    destination = "../myBookwithheader.pdf" 
    text = "Adobe" 
    align = "left"> 

Specify the source where the PDF document is located and the destination where the new PDF document with the header and footer will be saved.

You can also specify an image or text that you need to insert in the footer along with various other attributes such as align, bottommargin, leftmargin, numberformat, and opacity.

To remove header and footer from a PDF document, use the removeheaderfooter action, as shown in the following snippet:

<cfpdf action = "removeheaderfooter" source="..\mybook.pdf" destination = "new.pdf">

Use this action to remove the header and footer from a PDF document or from specified pages in a document.