I am using Lucee to generate pdf. PDF has more than 1 page. whenever pdf is being generated then header and footer are not coming into each . It is only coming to last page of pdf. I have attached sample code also. I am not able to identify what mistake I am doing. Any guidance will be helpful.
<h1>generating pdf</h1>
<cfdocument format="PDF" name="pdf" orientation="portrait" permissions="AllowPrinting" pagetype = "custom" pagewidth = "10" unit = "in" pageheight="10" marginLeft="0.25" marginRight="0.25" marginBottom=".5" marginTop=".5">
<cfdocumentitem type="header">
<div style="text-align:left;">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" align="left" width = "78" height="26" alt="Vitalware" id="logo"/>
</div>
</cfdocumentitem>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
<cfoutput>
</cfoutput>
td.mainBorder{ border: solid #BDBDBD 1px;}
td.showBorder{ border: solid #F2F2F2 1px;}
</style>
</head>
<html>
<body>
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
What a two-page spread is
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
What a two-page spread is
A two-page spread is a printing convention that represents leading and trailing pages in a bound or folded project such as a book, booklet, newsletter, or greeting card. Often, the pages in a two-page spread mirror one another.
<br/>
For example, pages 2 and 3 of this four-page newsletter make up a two-page spread.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.
<br/>
In this greeting card that opens from bottom to top, the inside of the card is a two-page spread.
The page sorter (the control at the bottom right of the publication window that consists of page-shaped icons) looks like this for both the four-page newsletter and the greeting card.<br/>
</body>
</html>
<cfdocumentitem type="footer">
<cfoutput>
<div style="text-align:right;font-size:xx-small;font-family:cambria;">
#cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
</div>
</cfoutput>
</cfdocumentitem>
</cfdocument>
<!--- <cfset getPageContext().getCfOutput().clearAll() /> --->
<cfset getPageContext().getRootOut().resetHTMLHead()>
<cfheader name="Content-Disposition" value="attachment; filename=test.pdf">
<cfcontent type="application/pdf" variable="#pdf#" />
I tried providing a link from trycf but its not allowing me to use above code to run.
You have an unnecessary <html>
opening tag on line 26 of your sample code. Removing that seems to make the headers/footers work ok.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
<cfoutput>
</cfoutput>
td.mainBorder{ border: solid #BDBDBD 1px;}
td.showBorder{ border: solid #F2F2F2 1px;}
</style>
</head>
<html><!--- <<-- Remove this --->
<body>