douju9272 2013-04-24 08:09
浏览 124
已采纳

TCPDF对齐标头

This is first time im using TCPDF , very good library but im not sure how to align SetHeaderData with my design

enter image description here

Here is my code :

define ('PDF_HEADER_STRING', "No. A-3-2, Kompleks Industri Puchong, No.1 Jalan TPP 1/6, Taman Perindustrian Puchong Seksyen 1, 47100 Puchong, Selangor Darul Ehsan, Malaysia.
Tel: (603) 8068 6119    Fax: (603) 8051 8119    Website: www.projectormalaysia.com

Quotation No: ".$quo_quotationNo."          Date: ".$_POST['date']);

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('AV Tech Solution Sdn Bhd');
$pdf->SetTitle('PDF Quotation');
$pdf->SetSubject('PDF Quotation');
$pdf->SetKeywords('');
$pdf->SetHeaderData('avs-logo.png', '30', 'AV Tech Solution Sdn. Bhd. (958788-U)'.' ', PDF_HEADER_STRING);
$pdf->setHeaderFont(Array('times', '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$tagvs = array('p' => array(0 => array('h' => 0.5, 'n' => 0.5), 1 => array('h' => 0.5, 'n' => 0.5)), 'br' => array(0 => array('h' => 1, 'n' => 1), 1 => array('h' => 1, 'n' => 1)));
$pdf->setHtmlVSpace($tagvs);
$pdf->setLanguageArray($l);
$pdf->SetFont('helvetica', '', 8);
$pdf->AddPage();
  • 写回答

1条回答 默认 最新

  • drqrdkfue521903877 2013-09-10 14:03
    关注

    I had a similar problem when my custom header was extremely small and not at all where I wanted it to be.

    It should be in one of the examples on the TCPDF website, Custom Header and Footer

    Just follow that and you should (hopefully) have no problem.. that is if you're still trying to work that out haha.

    It basically says you need to write a new function Header() to override the existing properties of the default header.

    Hope this helped, and good luck.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来