TCPDF生成动态阿拉伯语PDF非常慢 [英] TCPDF very slow generation of dynamic arabic PDF

查看:561
本文介绍了TCPDF生成动态阿拉伯语PDF非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用nusoap和amp; TCPDF用于ping Web服务并动态填写带有内容的PDF。

I've been using a combination of nusoap & TCPDF to ping a web service and dynamically fill out a PDF with content.

PDF本身(英文版)大约需要8-9秒才能完成大约36页,其中一些包括条形图。我还要注意,由于收到数据的格式,我使用writeHTML将其显示在PDF上。

The PDF itself (in english) takes around 8-9 seconds to complete for about 36 pages, some of which include bar charts. I'd also like to note that due to the format that the data is received in, I am using "writeHTML" to present it on the PDF.

我的主要问题当我开始尝试使用阿拉伯语翻译生成相同的PDF时出现了。我正在使用TCPDF示例中描述的Almohanad字体,处理时间上升到2分钟。

My major issue came around when I started trying to generate the same PDFs with arabic translations. I'm using the "Almohanad" font as described in the TCPDF examples, and the processing time jumped up to 2 minutes.

我尝试使用以下修复程序(缓存字体文件): http:// www.bitrealm.net/2010/08/tcpdf-is-slow-here-is-the-solution/

I've tried using the following fix (which caches font files) : http://www.bitrealm.net/2010/08/tcpdf-is-slow-here-is-the-solution/

唉它好像不起作用(即使我给tcpdf文件提供了完全的用户权限,也没有出现.CACHED文件)!我必须提到我需要在我的php文件的require_once部分之后插入ob_clean()以避免以下错误:

Alas it did not seem to work (the ".CACHED" file didn't appear even though I gave the tcpdf file full user permissions)! I do have to mention that i needed to insert ob_clean() after the "require_once" section of my php file to avoid the following error:

TCPDF错误:一些数据已经输出,无法发送PDF

"TCPDF error: Some data has already been output, can't send PDF"

我检查了我的php文件的空白区域,发现什么都不合适。

I checked my php files for white space and found nothing out of place.

总之,有没有人可以帮我加速使用TCPDF生成阿拉伯语PDF,或者推荐更快的替代方案?

In conclusion, could anyone help me speed up the generation of the arabic PDF using TCPDF, or else recommend a quicker alternative?

感谢您的时间。

推荐答案

在最新的TCPDF版本中,almohanad被aefurat和aealarabiya字体取代。

On the latest TCPDF version, the almohanad was replaced by aefurat and aealarabiya fonts.

最新的TCPDF版本使用addTTFfont()方法自动将字体转换为TCPDF格式,因此您可以轻松添加新的阿拉伯字体,如下例所示:

The latest TCPDF version automatically convert fonts into TCPDF format using the addTTFfont() method, so you can easily add new arabic fonts as on the example below:

// convert TTF font to TCPDF format and store it on the fonts folder
$fontname = $pdf->addTTFfont('/path-to-font/FontName.ttf', 'TrueTypeUnicode', '', 96);
// use the font
$pdf->SetFont($fontname, '', 14, '', false);

同时检查 http://projects.arabeyes.org 网站上的替代阿拉伯字体和 http:// www。 tcpdf.org 网站上的新字体指南。

Check also the http://projects.arabeyes.org website for alternative Arabic fonts and the http://www.tcpdf.org website for the new fonts guide.

这篇关于TCPDF生成动态阿拉伯语PDF非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆