php 在线 HTML 到 PDF 的转换 [英] HTML to PDF conversion in php online
问题描述
我一直在尝试开发一个可以将 html 文件转换为 pdf 的 php 程序.我在谷歌上搜索了这个问题,发现了这个软件 wkHTMLtoPDF 可以用于此目的的软件.我为 Windows 下载了它,并成功创建了我想要使用这些行的内容:
I've been trying to develop a php program that can convert an html file to pdf. I Googled the issue and found out this software wkHTMLtoPDF software which can be used for this purpose. I downloaded it for the windows and i successfully created what i wanted to using these lines:
$wkcommand = "\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf\" --page-width 300 --page-height 225 \"$url\" $dir\\$tempName.pdf &";
exec($wkcommand, $output, $error);
由于这些行在命令行中运行并且运行良好,现在我想让我的网站在线,但我无法理解我将如何在线使用此服务,因为我将使用免费的网络托管服务,例如:www.base.pk 用于此目的.我如何使用此工具在那里进行转换?
As these lines run in command line and works perfectly, now i want to make my website online but i can't understand how i will use this service online because i'm going to use a free web hosting service like: www.base.pk for this purpose. How can i use this tool for conversion there?
推荐答案
通常共享主机提供商禁止运行 ssh 命令.这意味着你不能运行 exec().而且这也意味着您需要 SERVER(虚拟或专用),以便您可以在那里进行配置.
Usually shared hosting providers forbid to run ssh commands. It means that you can't run exec(). And also it means that you need the SERVER (virtual or dedicated) so you would be able to configure that there.
这篇关于php 在线 HTML 到 PDF 的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!