douguachi0056 2012-02-07 00:41
浏览 164
已采纳

使用tcpdf库覆盖pdf文件

I am trying to write pdf file using TCPDF open source liberay.

i use following code..

$html = <<<EOD
$prod
EOD;

$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);

$pdf->Output('pricepdf.pdf', 'FD');

I have dumped $html, and its okay.

now, the problem is with writing pdf file, I can't write the file .either no error is displayed. Onething, i should clear that, a file with same name is already exists in the given folder.

What i want is, to ovewrite 'pricepdf.pdf' file everytime, i run the script

Please guide me regarding this, Is this overwrite problem? or something else is creating problem? I am stuck at the point...

  • 写回答

1条回答 默认 最新

  • dongqiao6445 2012-02-07 00:52
    关注

    If the script is not able to overwrite the file then you could check whether file exists and remove it.

    if (file_exists('pricepdf.pdf')) unlink('pricepdf.pdf');
    $pdf->Output('pricepdf.pdf', 'FD');
    

    Turn on errors display to see if there is a problem with access to the file.

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

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作