如何通过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.