Bruno Lowagie (iText) a écrit : > Damien Drix wrote: > >> Hello, >> >> In my application, I needed greater control over the rendering of text >> than the standard high-level iText API allows. For example, I had to >> support several line spacing modes, text wrapping around an arbitrary >> shape, etc. >> > > You can go a long way with ColumnText and/or PdfContentByte. > Only text wrapping around a shape is not possible (you can > have irregular columns, but you can't put an image in the > middle of a big chunk of text). > > >> To this end, I've been using low-level text processing classes such as >> BidiLine, PdfLine and PdfChunk (and also, >> PdfDocument.writeLineToContent()). As some of the required methods were >> protected or package-private, I had to declare one of my paragraph >> rendering classes as part of the com.lowagie.text.pdf package (luckily, >> the iText jar is not sealed). >> > > That's fine if you know what you are doing (and apparently > you know), but I wouldn't advice first-time users to open > up classes like BidiLine, PdfLine and PdfChunk ;-) > > >> It works perfectly well, but one is always a bit reluctant to use >> non-public members, and I think the low-level iText API would benefit >> from the text processing tools being made public. >> Do you think that could be done in a future release? This part of the >> code seems to be already quite mature and of API-grade quality, so it >> could be a simple matter of changing access permissions. Of course, this >> is not at all an urgent request, just a suggestion ;) >> > > I'm not sure if opening up the API would be a good thing, > especially if we don't provide good documentation (I wrote > an 'Under the hood' chapter for the book, but it didn't > discuss the classes you mention). > > My main problem isn't of a technical nature. It's just that > there are plenty of newbies out there and when they find an > example (any example) or a class (for instance PdfTable, > not PdfPTable), they fiddle with it the wrong way. Afterwards > they complain on the mailing list that it doesn't work > (or even worse: to me personally). If we open up classes > like PdfLine, this risk gets higher. > > I understand that concern very well! Maybe a simple wrapper around those classes, which would just chop Phrases into line fragments of the requested widths, and allow for drawing those fragments to the writer, would be less error-prone ? I could probably write and contribute it if you think it's a good idea. > But maybe I'm just being too pessimistic about it... > I'm not against it; it's a good suggestion, but I would > like to hear why ColumnText wasn't sufficient for your > needs, and of course I also want to hear what Paulo thinks > about it. > > The program I am writing will basically create PDFs from documents which can be quite complex (we're mostly interested in OpenDocument), and there are two main reasons why I couldn't use ColumnText : - This program will eventually replace an existing solution based on XSL-FO and FOP. It would have been awkward to end up supporting less formating features than before, and there were also a few features which FOP lacked and which we were interested in finally having. So, I had to implement a reasonable subset of all the things possible in ODF, some of which are not possible with ColumnText. For example, different line spacing modes (spacing using a fixed leading, a fixed/proportional line height, a minimum line height), "holes" in a paragraph, widows and orphans constraints, etc. Most are "exotic" features you would normally not care much about when creating a document from scratch, but that was precisely not the case! - Initially I wanted to add those features to ColumnText. But the architecture I chose for our rendering engine, and some features (widows and orphans in particular), did not fit well with the way ColumnText works (calling simulate() and go()).azzs
> best regards, > Bruno > Thanks again to you and Paulo for iText, which is a pleasure to program with ;-) Damien ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions