duanchongzi9997 2013-02-26 16:58 采纳率: 0%
浏览 91

如何从php文件“制作”pdf文件?

Lets say I have the following file:

layout.php

<?php
session_start();
?>
<table width="700" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <th>Id</th>
    <th>Nombre</td>
  </tr>
  <tr>
    <td><?php echo $_SESSION['id']; ?></td>
    <td><?php echo $_SESSION['nombre']; ?></td>
  </tr>
</table>

Is there a way where I can download that file as a PDF that will output the file like you see it in the browser?

I tried this but it didnt work:

<?php
session_start();

header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=info_user.pdf");
readfile('layout.php');
?>
  • 写回答

3条回答 默认 最新

  • dongxi1879 2013-02-26 17:00
    关注

    There are several packages that allow you to generate PDF files. You can have a look at these:

    评论

报告相同问题?

悬赏问题

  • ¥15 关于模型训练的一个问题
  • ¥15 装了几千台服务器从来没遇到这种问题,哎看下哪位帮我解决吧
  • ¥15 单片机程序上的困难问题
  • ¥15 请教某软件缓存Ts文件破解合并mp4的方法
  • ¥15 求小游戏炸弹人中关于敌人的C++代码
  • ¥15 拿到服务器最高权限步骤
  • ¥50 来个抓app跳转支付宝转链接的
  • ¥15 remotes安装提示没有description文件
  • ¥15 AttributeError: 'NoneType' object has no attribute 'drop_duplicates'报错
  • ¥15 以下代码,运行结果报错