This question already has answers here:
Convert Word doc, docx and Excel xls, xlsx to PDF with PHP
(12 answers)
Closed 4 years ago.
I want to know how to convert document file to pdf using php or codeigniter.
If anyone have any idea about the same please let me know.
To complete this, I would recommend two libraries. The first (I have not used), as Word documents are not plaintext, you will need to be able to read the Word doc. For this, try PHPWord. This appears to have been used in other projects for the purpose of reading Word docs (and creating them).
Secondly, converting to PDF use FPDF, this library I have a lot of experience. It's been around a long time so there is some great examples and documentation. It doesn't take long to figure out but does require a bit of playing around to get the PDF doc looking exactly as you like. If you need any additional info using this library, give me a shout. But both of these should help you. FPDF can also be very easily converted to a Codeigniter library. I used it in a CiBonfire application before.
Related
This question already has answers here:
Reading an Excel file in PHP [closed]
(8 answers)
Closed 6 years ago.
I am wondering if I can get some advice on folks that might have come across this before.
Basically I have a folder with files a user can add / remove which has an iframe beside it so they can view their PDF's etc.
I cannot get excel (probably ppt either) to open up in chrome or a browser.
I know I can go through google docs, or send files and get it back different format through their api but for security it is not a solution I want to work with.
example I saw in excel:
If I have a fairly loaded excel file, graph, formulas etc., in that file I 'Save As' and convert to htm I can publish option which provides a beautiful htm page with all relative pics, links in a folder. If I can get php to do something similar this would really make my day.
I played with PHPExcel but it usually spits out a mess, sometimes just crashes because of formulas. Unless I just haven't sent the time with PHPExcel to figure this out I don't know what else to do.
You already know the best way use read excel file to php using any library then print the data.
if PHPExcel not working for you please have a look at following
"Reading an Excel file in PHP"
ps. if you are facing problem with PHPExcel kindly post you code in new question, definitely this great developer community will help you resolve that.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Alternative for PHP_excel
A friend would like to use a Php Excel library to read/write files on formats xls and xlsx, he knows about the one called "PhpExcel" but apparently is way too big of a library for him.
I would like you to suggest if there is any other phplib you could recommend him.
Update
Please people vote this question up if you think this post is useful even when some have considered it not good enough to give it negative points (very strange since it has a lot of views and seems it has actually helped to some users). Thank you very much.
Reading only: http://sourceforge.net/projects/phpexcelreader/ 21.5kb
Create your own very simply: http://www.ibm.com/developerworks/opensource/library/os-phpexcel/
You won't find a lightweight library that can both read and write both xls and xlsx files other than PHPExcel. However, if you want a list of the available options for working with Excel files in PHP, you can find it here.
OpenTBS can generate XLSX files using the technic of templates.
It can also read any sub XML file in the XLSX.
OpenTBS can do the same with any Ms Office (docx, xlsx, pptx) and OpenOffice documents.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Convert HTML + CSS to PDF with PHP?
I was searching for a way to convert HTML to PDF, but all I found was very limited.
There are plenty of issues you need to address, which you have failed to do so. Does it need to support advanced table structures, css support etc. As a start you can look into html2pdf or a paid solution PrinceXML
If you can use printing, you may try using the FreePDF XP printer driver.
It uses GhostScript, so a library for it, if you want to do it programatically, may also do the trick.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Convert HTML + CSS to PDF with PHP?
Is it possible to convert a HTML page to PDF using PHP, and if so, how can it be done?
Specifically, the page is an invoice generated dynamically. So I would like it loaded using:
http://example.com/invoices/3333
And the HTML output would have to be converted to PDF.
Any good libraries that do this will be fine.
If you wish to create a pdf from php, pdflib will help you (as some others suggested).
Else, if you want to convert an HTML page to PDF via PHP, you'll find a little trouble outta here.. For 3 years I've been trying to do it as best as I can.
So, the options I know are:
DOMPDF : php class that wraps the html and builds the pdf. Works good, customizable (if you know php), based on pdflib, if I remember right it takes even some CSS. Bad news: slow when the html is big or complex.
HTML2PS: same as DOMPDF, but this one converts first to a .ps (ghostscript) file, then, to whatever format you need (pdf, jpg, png). For me is little better than dompdf, but has the same speed problem.. but, better compatibility with CSS.
Those two are php classes, but if you can install some software on the server, and access it throught passthru() or system(), give a look to these too:
wkhtmltopdf: based on webkit (safari's wrapper), is really fast and powerful.. seems like this is the best one (atm) for converting html pages to pdf on the fly; taking only 2 seconds for a 3 page xHTML document with CSS2. It is a recent project, anyway, the google.code page is often updated.
htmldoc : This one is a tank, it never really stops/crashes.. the project looks dead since 2007, but anyway if you don't need CSS compatibility this can be nice for you.
This question already has answers here:
Closed 14 years ago.
I have some HTML that includes bolding, italics, small tag, big tag, blockquote tag, bullets, and numbered items. I need to convert it to PDF via PHP. I tried FPDF, but it was entirely too complex. I tried the html2pdf PHP library, which uses FPDF, but it was very buggy and unreliable. What do you recommend?
Note: Imagine your typical resume. I'm needing to format something like that.
Take a look at FPDF
I've had a lot of success with dompdf.
Make sure you have valid HTML though, or it can get into a loop.
It's very simple to use - about 4 lines to convert an HTML file to a PDF.
I have had good experiences with PrinceXML. Their rendering engine is very good. Passes acid2 and has good .svg support so you can include vector images instead of bitmaps to keep the .PDF relatively small (which is important when generating reports which need to be sent as an attachment).
(note that princexml is proprietary software).
http://www.ros.co.nz/pdf/
I once used the above to turn incredibly complex architect's tile specifications into PDFs on a dynamic basis and it worked out well. I found the class very approachable and easily modifiable.