php pdf打印错误,TP框架使用TCPDF这个生成PDF文件的类出现错误??

TCPDF ERROR: Some data has already been output, can't send PDF file

想问下为什么会这样啊。

我在控制器

public function guaranteeAgreement(){

..........//省略

$this->assign ( 'names', $str );

$this->assign ( 'invs', $invs );

$this->assign ( 'binfo', $binfo );

$this->assign ( 'borrower', $borrower );

$this->assign ( 'cd_member', $cd_member );

$html = $this->fetch ( 'agreement:guarantee' );

$data['html'] = $html;

$this->downAgreement($data);

}

private function downAgreement($data) {

$this->pdfPath = C ( "APP_ROOT" ) . 'Lib/Tcpdf/';

require $this->pdfPath . 'config/lang/eng.php';

require $this->pdfPath . 'tcpdf.php';

$pdf = new TCPDF ( PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false );

$pdf->SetCreator ( PDF_CREATOR );

$pdf->SetAuthor ( str_replace ( "http://", "", "http://" . $_SERVER ['HTTP_HOST'] ) );

$pdf->SetTitle ( $data['title'] );

$pdf->SetSubject ( $data['subject'] );

$pdf->SetKeywords ( $data['keywords'] );

$pdf->SetHeaderData ( PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH );

$pdf->setHeaderFont ( Array (

PDF_FONT_NAME_MAIN,

'',

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 );

$pdf->setLanguageArray ( $l );

$pdf->SetFont ( 'droidsansfallback', '', 20 );

$pdf->AddPage ();

$this->mypdf = $pdf;

$this->mypdf->writeHTML ( $data['html'], true, false, true, false, '' );

$posx = $this->mypdf->GetX ();

$posy = $this->mypdf->GetY ();

$posx = $posx + 40;

if ($posy > 50)

$posy = $posy - 50;

$path = str_replace ( 'App/Lib/Tcpdf/', '', K_PATH_MAIN );

$this->mypdf->Output ( $data['title'] . '.pdf', 'I' );

}

我并没有在 方法里 打印数据,为什么会提示这个啊

TCPDF ERROR: Some data has already been output, can't send PDF file

控制器继承的父类也没有什么问题啊,请问还有什么可能的原因啊

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值