I was googling many hours but I haven't got solution yet.
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...
I was googling many hours but I haven't got solution yet.
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 will do it directly (read XLS, output PDF), although the results are not very pretty.
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.
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.
use headless libreoffice and a shell command
shell_exec('C:\wamp64\www\phpexcel\lo\App\libreoffice\program\soffice.exe --headless --convert-to pdf:calc_pdf_Export --outdir C:\wamp64\www\phpexcel\o C:\wamp64\www\phpexcel\new.xlsx');
Anyone who is looking to do this in Ubuntu/linux using php -
Ubuntu comes with libre office installed default. Anyone can use the shell command to use the headless libre office for this.
shell_exec('/usr/bin/libreoffice --headless --convert-to pdf:calc_pdf_Export --outdir /var/www/html/XlsToPdf/public_html/src/var/output /var/www/html/XlsToPdf/public_html/src/var/source/company-a.xlsx');
Hope it helps a others like me.