Welcome Guest, Not a member yet? Register   Sign In
Generating server-side pdf's
#1

[eluser]SomeFunkyDude[/eluser]
I'm trying to make an app in CI that lets me make pdf's, I think at this point I have a viable solution, but just thought I'd share the info of what I've learned over the past 7 days lol.

Libraries like PDFLib which is included with PHP aren't totally open source, so I wanted to stick with open source. See the PDFLib disclaimer on php.net's site

First off, some libraries like DOMPDF support html and css. Of the 3 open source libraries I came across (DOMPDF, TCPDF, and FPDF) DOMPDF had the best css support, but was still difficult to work with since floats or relative/absolute positioning isn't supported and nested tables don't always work as expected. To get the template just right (if its an elaborate form), you'll probably find yourself spending a lot of time with it, and even still when you populate it with data the data might add extra spacing and throw the layout out of wack. Another note, and it didn't really make a difference in the rendering, but DOMPDF uses PDFLib by default, so if your using the library commercially, you'll probably want to switch to it's other base class (R&OS;PDF class)

Another option was to see if I could populate form fields in a pdf document that I precreated. PDF's support form fields that can be filled using the FDF (forms data format). Adobe offers a FDF toolkit that is a server-side library (not-php) that lets you populate a pdf. I didn't get too far with this partly because it meant installing extra libraries on my server and php's FDF extension requires the FDFToolkit from adobe, and the php FDF extension is no longer bundled with php as of 5.3 which is odd because it seems like a useful library.

So, the option I'm exploring now, which seems to be the best in my opinion, is to precreate a pdf form with the layout exactly the way I want in InDesign (not html), then using a class from http://www.setasign.de called FDPI, you can load a pdf as a template, then use php (via fpdf) to generate text over it. So in other words, the FDPI class extends the FPDF class which gives you the ability to write over a pdf and save it.
#2

[eluser]LeRoux[/eluser]
I have been able to succesfully use the fpdf library in my existing CI CRM site but I agree with everything that you mentioned. I can't help but feel that whatever open source solution I try to use I always bump my head against some of the capabilities available.
My problem at the moment is using the free FDF toolkit provided by Adobe in my CI site. There are various PHP classes available for this, but again what are the limitations?

Using the commercial versions are becoming increasingly attractive for me. I do however have a few queries that you might be able to answer for me...

What is the main difference (other than price), between the Adobe SDK and PDFLib?
Have you seen/read anything that might give you an indication that by using Adobe SDK or PDFLib you will experience better rendering of fonts and images?
#3

[eluser]SomeFunkyDude[/eluser]
The FDF toolkit is a server-side library that fills in your FDF forms (forms that are created beforehand I think), and PDFLib I think you can actually generated layouts for a pdf from the server. I don't think you can render images from the FDF toolkit tho I might be wrong. I think in either case you can choose what fonts you want. I came across this for pdflib you might want to check it, it shows what pdflib is capable of http://www.pdflib.com/pdflib-cookbook/al...-overview/
#4

[eluser]LeRoux[/eluser]
Yes, the FDF toolkits purpose is to handle the form filling on PDF documents and not any pdf generation or image rendering onto PDF. For this you must use the PDFLib or similar. However, PDFLib does not support any FDF or form filling.I am aware of all this.
I am now looking for a base class/sdk/api that is either commercial or opensource, but with the most amount of functionality including the ability to handle FDF in its PHP version and with the best image handling/rendering. Which one (base class) have you found to be the best in this regard?
#5

[eluser]Kamarg[/eluser]
I found that it was far easier to switch to using xdp files (which have been supported by Acrobat since version 6) than to get PDFLib working properly. It's an xml format for filling fields in a pdf file. Stack Overflow has a fairly good thread for getting the basics working and I've written a CI library that I can post if you're interested.




Theme © iAndrew 2016 - Forum software by © MyBB