I actually hadn't heard of DOMpdf before. It looks pretty interesting, particularly it's CSS support which is something that I am looking to implement. Mine doesn't have some of the limitations that it has listed on it's features page, like nested tables. It looks like they have taken great care to get all of the css styles correct though which is something I was a little sloppy on. I think I will use it as a reference to compare my renderings to to make sure when I add in CSS support that I am getting it right. Or maybe if their code is really good I could start from there and add in what I need. I will check it out more as I get started on my own implementation. Thanks for referring it to me.

I will try to get the text block / rich text support going soon with some examples. As soon as I do I will let you know where you can download it from.

Thanks,

Rick


On Nov 8, 2007, at 3:05 PM, Bryce Lohr wrote:

I would also be interested in this code. The functionality you have there would be great for Zend_Pdf. I saw a proposal (but I can't seem to find it right now) from the Zend_Pdf author outlining much of the same things as the future direction for Zend_Pdf. He was building up an object model loosely based on XSL-FO. I agree with your sentiments about FO; a more streamlined subset might be more practical in general. Also, I'm sure you've seen DOMpdf; a CSS interpreter written in PHP that renders to PHP; there's probably a lot of good ideas in there to reuse.

Regards,
Bryce Lohr


Rick Gigger wrote:
On Nov 8, 2007, at 9:26 AM, Philip Iezzi wrote:

Rick Gigger wrote:
Yes, I was aware of those. I don't use them because I implemented my
own xml based solutions that has support for tables, page breaking,
columns, full rich text support, etc. The basic support in those two
engines was never enough.  All I really need are the primitives to
measure, style and draw text, and of course primitive line and shape drawing operations. I have an abstraction layer that lets me swap back and forth between R&OS and FPDF. My XML parser / DOM style rendering library handles the rest. So I don't think it would be too hard to use
Zend_Pdf instead.

Great! Any way of contributing your code to the community?
I just started to switch from PEAR::File_PDF to Zend_Pdf but I'm kind of disappointed that Zend_Pdf is still at the same spot as a year ago what concerns improved text functions. I played around with Zend_Pdf_Cell presented in issue http://framework.zend.com/issues/browse/ZF-1254 but it does not work as expected (e.g. character width is not calculated correctly, center alignment is no real center alignment, line wrapping does not seem to work at all,...).
We all would terribly appreciate your piece of code!

I can make the existing code available right now if people want it but I think some code cleanup and documentation would be needed before it could be accepted into something like Zend Framework. If anyone wants to help out with that effort that would be great.

The biggest issue is that the XML format is mostly in my head and only documented in stuff that I have already done so in order to figure out how to use it you have to have access to examples or you have to pick through the code. Also as with most first attempts at something complicated you finish it up, get it working and finally know the way it really should have been done in the first place.

So I think the best thing would be to start a clean implementation now. I can start with basic rich text / wrapping / alignment features. I will be able to copy most of that over directly from the existing project because that code is very good and is actually more of a 4th or 5th generation product. I started off doing simple text wrapping and alignment on R&OS PDF about 5 years ago and it has evolved significantly since then. That should be immediately useful to people and could be used on top of Zend_Pdf without actually modifying it.

First will come the DOM objects for doing the rendering and shortly thereafter I will include an extensible XML parser so that creating documents and testing will be much easier.

Then I can start to add stuff like tables and columns and other layout features where I will need to do a little more R&D. Eventually if the Zend people want to start incorporating it into the framework they will be more than welcome to. I would be willing to help out with the integration where my time and expertise permits.

The only thing that has really been keeping me from releasing this stuff in the past (other than time of course) is that I didn't know anyone who was interested in it. If I could get some feedback from you guys as I go it would be very helpful to me.

One thing to keep in mind is that my DOM is loosely based on XHTML. I have drawn most of my tag names from it and am in the middle of a rudimentary CSS implemention to abstract some of the style information out of the XML. I have made specific changes though for precision placement of layout items and for precise control of page breaking and associated needs. For example I have attributes on table headers to control whether or not they repeat if the table is broken across multiple pages. I don't see any reason though that someone couldn't write a completely different XML layer (FOP?) and use my DOM objects underneath. That is where all the real work is anyway. The drawback there is that the naming of the DOM objects will in most instances correspond with HTML tag names and their functionality will be geared towards my view of what you need to do proper PDF layouts, which may be very different from something like FOP. My impression of FOP was that it might be great but it was a little too ambitions. I say that with regards to both implementing and using it. By focusing on a subset of XHTML I was able to get the functionality that I needed working quickly and it is somewhat intuitive to learn for anyone who has done even basic HTML work.

Anyway anyone who is interested let me know and I will notify you (or should I just notify the list) when I have something ready for you to download.

Thanks,

Rick

Reply via email to