douci1615 2012-04-12 10:08
浏览 229
已采纳

tcpdf位于页面底部的页脚

I am using tcpdf to add a pdf to an email that is sent out by the system. When the email arrives, the office opens it and prints off the pdf and posts it for customers not setup on the system for email. The problem is that when tcpdf generates the pdf's it is putting the footer directly under the contents of the letter. The problem with this is that the pdf is using the company's letterhead template and puts the header in the correct position, but the footer is supposed to go at the bottom of the page, but it moves according to the position of the content, where as for it to look like the same as their letterhead needs to be at the bottom.

I am currently using the following (I know the POSTS's are insecure, im sorting that one shortly when I go through everything) :

    <?php

    $message = $_POST[emailformmessage];
    $cf_id = $_POST[cf_id];
    $leadname = $_POST[leadname];
    $postcode = $_GET[postcode];
    $address = $_GET[address];
    $date = $_GET[date];
    $town = $_GET[town];
    $business = $_POST[businessname];




    $html = "<html>
    <head>
    <style>

    .container {width:680px; font-family:Arial, Helvetica, sans-serif; font-size:44px;}

    .header {margin-left:50px; margin-right:50px; margin-top:15px;}

    .customeraddress {color:#000;margin-left:65px; margin-right:65px; margin-top:25px; text-align:left;}

    .delivered {color:#fff; background:#344EA2; margin-left:80px; margin-top:5px; text-align:center;padding:15px; margin-right:80px;}

    .titles_L {color:#fff; background:#13155C; margin-left:80px; margin-top:5px; text-align:center; padding:5px; width:250px; float:left; font-weight:bold;}

    .titles_R {color:#fff; background:#13155C; margin-top:5px; text-align:center; padding:5px; margin-right:80px; width:250px; float:left; font-weight:bold;}

    .body-text { background:#fff;color:#333; margin-left:65px; margin-top:5px; text-align:left; padding:15px 0px 15px 0px; margin-right:65px; overflow:auto;}

    .terms {color:#fff;margin-left:80px; margin-top:5px; text-align:center;  padding:15px; margin-right:80px;}

    .footer {margin-left:50px; margin-top:5px; text-align:left; font-size:40px; padding:15px; margin-right:50px; color:#000; overflow:auto;}

    .footer a {}

    .footer_left {float:left; width:100px;}

    .footer_right {float:left;}

    .clear {clear:both; float:none;}

    .footerclear {clear:both; float:none; width:100%; padding:8px;}

    .pricerow {}

    .emailpricesgasoil {width:240px; float:left;  padding-bottom:15px; padding-top:15px; margin:2px 0px 2px 0px;background:#f4f4f4;color:#EE3B33;}

    .emailpricesderv {width:240px; float:left;  padding-bottom:15px; padding-top:15px; margin:2px 0px 2px 0px;background:#f4f4f4;color:#EE3B33;}

    .emailpriceskero {width:240px; float:left;  padding-bottom:15px; padding-top:15px; margin:2px 0px 2px 0px;background:#f4f4f4;color:#EE3B33;}

    .emailfueldescgasoil {width:250px; float:left;  padding-bottom:15px; padding-top:15px;margin:2px 0px 2px 0px;background:#f1f1f1;}

    .emailfueldescderv {width:250px; float:left;  padding-bottom:15px; padding-top:15px; margin:2px 0px 2px 0px;background:#f1f1f1;}

    .emailfueldesckero {width:250px; float:left;  padding-bottom:15px; padding-top:15px;  margin-top:2px; margin:2px 0px 2px 0px; background:#f1f1f1;}
    </style>
    </head>
    <body>


    <div class=\"container\">

    <img class=\"header\" src=\"http://key4design.co.uk/chandlers/images/chandlers_header.jpg\" width=\"996\" height=\"326\">

    <div class=\"customeraddress\">
    $leadname<br/>
    $business<br/>
    $address<br/>
    $town<br/>
    $postcode<br/>
    $date<br/>
    </div>
    <div class=\"clear\"></div>

    <div class=\"body-text\">
     $message</div>
    <div class=\"clear\"></div>
    <div class=\"footer\">
    <img class=\"footerimg\" src=\"http://key4design.co.uk/chandlers/images/chandlers_footer.jpg\" width=\"996\" height=\"261\">
    <div class=\"footerclear\"></div>
    </div>

    </body>
    </html>";
    $old_limit = ini_set("memory_limit", "16M");
    require_once("./pdf/config/lang/eng.php");
    require_once("./pdf/tcpdf.php");
    $pdf = new TCPDF("portrait", PDF_UNIT, "a3", true, "UTF-8", false);
    // set font
    $pdf->SetFont("helvetica", "", 10);
    // add a page
    $pdf->AddPage();
    $pdf->writeHTML($html, true, false, true, false, "");
    // reset pointer to the last page
    $pdf->lastPage();
    //Close and output PDF document
    if(!file_exists("./pdf/doc/file.pdf") || is_writable("./pdf/doc/file.pdf"))
    $pdf->Output("./pdf/doc/file.pdf", "F");
    else
    exit("./pdf/doc/file.pdf");
    ?>
  • 写回答

2条回答 默认 最新

  • douwenpin0428 2012-04-12 10:53
    关注

    Seems you only added an image in the footer, why not just use the Image Function

    $pdf->AddPage();
    $pdf->writeHTML($html, true, false, true, false, "");
    $pdf->Image('http://key4design.co.uk/chandlers/images/chandlers_footer.jpg', 100, 350);
    // reset pointer to the last page
    $pdf->lastPage();  
    

    You might have to disable the default footer

    $pdf->setPrintFooter(false);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了