如何通过PHP将.xls转换为.pdf? [英] How to convert .xls to .pdf via PHP?

查看:113
本文介绍了如何通过PHP将.xls转换为.pdf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜查了好几个小时,但是还没有解决办法.

I was googling many hours but I haven't got solution yet.

我需要将.xls文件转换为.pdf文件.怎么做?我已经找到了这个 http://www.aspose.com/,但似乎并没有有了PHP API,只有.NET和JAVA.

I need to convert .xls file into .pdf file. How to do that? I have found this http://www.aspose.com/, but it seems, that it hasn't got PHP API, only .NET and JAVA.

感谢您的每条建议...

Thanks for every advice...

推荐答案

PHPExcel 会直接做到(阅读XLS,输出PDF),尽管结果不是很漂亮.

PHPExcel will do it directly (read XLS, output PDF), although the results are not very pretty.

更好的解决方案可能是使用PHPExcel读取XLS文件,然后将其渲染为代码中的HTML&按照您喜欢的方式对其进行样式设置,然后使用HTML-> PDF转换器,例如 DOMPDF (我尝试过的唯一一个;还有其他)可以转换为PDF.

A better solution might be to use PHPExcel to read the XLS file, render it to HTML in your code & style it the way you like it, then use an HTML->PDF converter like DOMPDF (that's the only one I've tried; there are others) to convert to PDF.

或者,如果您想跳过HTML步骤,请使用其中的一个PHP PDF库将其直接呈现为PDF-我个人最喜欢的是

Or, if you want to skip the HTML step, render it directly to PDF using one of the PHP PDF libraries out there - my personal favourite is FPDF.

这篇关于如何通过PHP将.xls转换为.pdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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