Help with TCPDF

Hi Experts,

I'm new to TCPDF, but put together the following code:
        //Get Agent List
        $agents = self::get_agent_list($archived, FALSE, 1, FALSE, 'fName');
        if ($archived == TRUE){
            $title ='Archived Agents';
        } else {
            $title ='Active Agents';
        //Connect to TCPDF
            //Temporarily Change directory to TCPDF to load files...
            $currentDIR = getcwd();

            //Change DIR back
            //Setup PDF File
            $pdf = new TCPDF('P', 'mm', 'Letter');
            $pdf->SetMargins(10, 10, 10);
            $pdf->SetFont('helvetica', 'I', 8);

        //Setup Title on p.1
        //Data Container
            $html = "";
            foreach ($agents as $agent){
                $html = $html . $agent['fName'] . "<br>";
            //echo $html;        
        //Setup footer
            // Position at 15 mm from bottom
            $today = new DateTime('today');
            $today_f = $today->format('F d, Y');
            $pdf->Cell(0, 0, $today_f, 0, 0, 'left');
            $page = 'Page ' . $pdf->getAliasNumPage() . ' of ' . $pdf->getAliasNbPages();
            $pdf->Cell(0, 0, $page, 0, 0, 'right');

        //Page Header, starting p.2
        //Generate File
            $file = 'AgentList.pdf';

Open in new window

Two things I'm not sure why are they happenning:

1- On the top of every page, I'm getting a horizontal line.

2-My footer only appears on the last page.

Any help would be greatly appreciated.

Thank you.
APD TorontoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can you attach an example PDF that was generated?
APD TorontoSoftware DeveloperAuthor Commented:
Actually I have almost everything figured out, but do you know how to set page size to letter (8.5 x 11)?
Your code already indicates you're using letter:
$pdf = new TCPDF('P', 'mm', 'Letter');

That "Letter" should be defined in the file include/tcpdf_static.php (it's actually case-insensitve, so "Letter", "letter", "LETTER", etc... should all work).

What's it coming out as?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.