Can I convert HTML to PDF ?

Dec 2, 2008 at 1:30 PM
Can this convert HTML to PDF ?

I need to convert Excel to PDF but I believe PHPExcel struggles with this (everything is 5 times the size it should be).

I have heard you can convert Excel to HTML and then to PDF - with no problems.

What should I do?

I know you can get many other tools that can convert HTML to PDF, but hopefully this will do it all as I have spent some time trying to get familiar with it.

My programming knowledge is "average".

I only need this for one quick task, so I dont want to spend ages doing it - although it is quite important.
Developer
Dec 2, 2008 at 8:21 PM
I'm afraid there is no way to convert HTML to PDF within PHPExcel. This task would at least have required an HTML reader within PHPExcel, but there is no such thing. It would probably not have helped much to reduce memory usage anyway, as these lie in the core of PHPExcel and have not been sorted out yet.

I do see there could be a need for something like PHPExcel_Reader_HTML, so I put feature request:
http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=8371

When you convert from Excel to PDF using PHPExcel: Is the result what you expected? Is it just the memory / speed that is the problem, or are there other problems as well?
Dec 3, 2008 at 12:32 AM
Koyama: When you convert from Excel to PDF using PHPExcel: Is the result what you expected? Is it just the memory / speed that is the problem, or are there other problems as well?


It would be perfect other than that what you would expect to occupy half a page takes up about 4 pages - everything is just blown up much bigger.
Developer
Dec 3, 2008 at 1:27 AM
The PDF writer does have problems. The problem is apparently with the external FPDF library. So don't have too high expectations with your PDF output using PHPExcel.

There are various cell height problems and text wrap problems, also there is no UTF-8 support.
http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=7083
http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=6742

PDF writer is ok for simple layouts, but for complex layouts you may run into problems.