繁体   English   中英

PHP 5.2.17版本中的PDF支持

[英]Pdf support in php 5.2.17 version

我的PHP版本是5.2.17。 我想使用php创建一个pdf文件。 我已经写了这段代码

$mypdf = PDF_new();
        PDF_open_file($mypdf, "");
        PDF_begin_page($mypdf, 595, 842);
        $myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0);
        PDF_setfont($mypdf, $myfont, 10);
        PDF_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750);
        PDF_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730);
        PDF_end_page($mypdf);
        PDF_close($mypdf);

        $mybuf = PDF_get_buffer($mypdf);
        $mylen = strlen($mybuf);
        header("Content-type: application/pdf");
        header("Content-Length: $mylen");
        header("Content-Disposition: inline; filename=gen01.pdf");
        print $mybuf;

        PDF_delete($mypdf)

;

这段代码在我的本地主机上运行正常,但是在我的服务器上却无法运行。 在我的服务器上未创建$mypdf 在我的服务器上使用的是php 5.2.17版本。 问题是什么 ? 我认为pdf库在我的服务器上不起作用。 请帮我

确保您的服务器已安装PDFlib。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM