iPad 上的 TCPDF 问题

发布于 2024-12-15 07:41:18 字数 335 浏览 1 评论 0原文

我在网站上动态创建了一个 PDF,该 PDF 无法在 iPad 上显示。它在计算机和 iPhone 上显示,但在 iPad 上不显示。错误报告显示错误:

Fatal error: Call to undefined function imagecreatefrompng() in pdf/tcpdf.php on line 8194

这是一个 GD 库函数,在所有其他平台上都可以正常加载,那么为什么在 iPad 上会出现问题呢?这不应该由 apache 处理吗,如果是的话我怎样才能强制它加载 lGD 库?我完全不知道如何解决这个问题!任何帮助将不胜感激!

先感谢您。

I have a dynamically created PDF on a site that will not display on an iPad. It displays on computers and iPhones but not on the iPad. With error reporting on it gives the error:

Fatal error: Call to undefined function imagecreatefrompng() in pdf/tcpdf.php on line 8194

This is a GD library function that loads fine on all other platforms, so why is there an issue on the iPad? Shouldn't this be handled by apache, if so how can I force it to load the lGD library? I am at a total loss for how to fix this! Any help would be greatly appreciated!

Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

数理化全能战士 2024-12-22 07:41:18

你是对的;您使用 iPad 访问 PHP 应用程序这一事实不应影响加载哪些模块。

请检查您是否确实正在访问您认为的服务器以及您认为的虚拟主机。在我看来,您最有可能正在访问一台设备上的开发服务器和另一台设备上的测试服务器。尽管可能性不大,但 apache 配置或 .htaccess 文件包含的指令可能会阻止在给定情况下设置某些 PHP 标志。

请检查应用程序的源代码以查找对 dl 方法 的调用。如果 php.ini 中默认未加载,应用程序可能会检查 GD 库并加载它。逻辑错误可能会阻止该方法被调用。

确认这一点后,您也许可以使用 phpinfo 来调试问题。放入此方法,看看您是否能注意到 PHP 版本和加载的模块之间的差异。输出中可能有一些线索可以帮助您解决此问题。

You are correct; the fact that you are using an iPad to access a PHP application should not affect what modules are loaded.

Please check that you are actually accessing the server you think you are, and the vhost that you think you are. It seems most likely to me that you are accessing for example, a development server on one device and a test server on another. It is possible, although unlikely, that the apache configuration or .htaccess files contain directives that will stop certain PHP flags from being set in given situations.

Please check the source code of your application for calls to the dl method. It is possible that the application will check for the GD library and load it if it is not loaded by default in php.ini. A logic error could be preventing the method from being called.

Once you have confirmed this, you might be able to debug the issue by using phpinfo. Drop this method in and see if you can notice a difference between PHP versions and loaded modules. There may be a clue in the output that could help you solve this issue.

我很OK 2024-12-22 07:41:18

更改字体,只是在黑暗中拍摄,我在 safari 中遇到了同样的问题,并通过更改字体解决了

例如

$pdf->SetFont('helvetica', '', 4, '', true);

Change Font , Just a shot in dark , i had same problem with safari and solved with changing font

For example

$pdf->SetFont('helvetica', '', 4, '', true);
别靠近我心 2024-12-22 07:41:18

我最终注释掉了有问题的行。这并不是问题的真正答案,但它可以在不破坏任何东西的情况下工作。

I ended up commenting out the line in question. Not truly an answer to the question but it works without breaking anything.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文