0

Hi Everyone

I want to convert Excel File to PDF using PHP.
Can anyone guide me in this matter?

I have tried PHPExcel by using tcpdf,mpdf,docpdf libraries but they didn't produce good layout.

Do you have any other suggestion?

Waiting for your reply.

4
Contributors
6
Replies
27
Views
3 Years
Discussion Span
Last Post by jazleeen
1

What was the problem with the layout? TCPDF is quite flexible and I did not have problems creating nice tables.

1

When I need to produce a PDF file, I use HTML2PDF. In this case it would require some extra work to read the Excel file and generate a report output in the format that you want in PDF. If you can get PHPExcel working it will probably be less work but if not, this is another way to do it.

0

@chrishea
Thanks for your reply.
If i use HTML2PDF,how can i handle excel file?

0

@broj1
Thanks for reply.
My problem is the values of cells are not aligned,and i want to use different font size for different cells.
My code generateds pdf but cells are not justified.

1

I have used the php-excel-reader quite successfully. I don't believe that it handles the newer formats (xlsx) so if that is required there are other tools available. You can also have a look at this.

Votes + Comments
Thanks
1

By installing "Openoffice.org" on the server we can convert doc or xls file to pdf.
Steps to convert:

  1. install openoffice.org
  2. After that server has the capabilities to handle doc or xls files. Then you can able to covert the doc or xls file to pdf by command line instruction using php.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.