Not a bad idea... I've never been a big fan of XSLT, always seemed overly difficult to me for what it was, but certainly sticking with a standard has appeal, and I've done a little bit of FOP work, so it's not all new.
One thing I was thinking about for the Ajax result stuff was to have optionally a toXML() and toJSON() method on the Action... if they are present, they would be used by the Results rather than the automatic generation process... would allow for more complex outputs than the automatic process is capable of.. having toXML() on the Action might be a good idea in general, precisely for things like PDF generation and the XSLT Result you mention. Maybe some default implementation (the one from AjaxXMLResult possibly?) in ActionSupport might open some doors? In any case, I may have to play with your suggestion a bit and see what it might look like... I like the idea of using standards, but I have some doubts as to how easy it would be for developers to use, generally. Frank On Mon, June 5, 2006 3:24 pm, Ian Roughley wrote: > I think there is also a XSLT result - I haven't researched it at all, > but another option might be to return XML from the action and then > supply a FO XSLT to turn the results into a PDF. > > /Ian > > Frank W. Zammetti wrote: >> Hey all... I find myself wanting to drive my company towards using SAF2, >> or really WW for the moment, and one of the things that comes up >> frequently around here that would be required, as I know it does for >> many >> people, is PDF generation. >> >> I was thinking of how to make this easier for people... A while back, I >> wrote something called ITextXMLWrapper. As its name implies, it >> provides >> for creating templates in a custom XML format, and then generating the >> PDF >> from that, using a List of Maps as replacement tokens inside the >> template >> (a List of Maps essentially representing a SQL query ResultSet). >> >> So, for instance, I might have the following template: >> >> <ITextXMLWrapper footer="Some footer text"> >> <placeImage source="DBMS" alignment="center" table="logos" >> field="logo" >> query="filename='MYLOGO.GIF'" /> >> <drawNewLine /> >> <setFont fontName="Times-Roman" fontEncoding="Cp1250" >> fontEmbedded="false" fontSize="9" bold="true" italic="false" >> underline="false" /> >> <drawParagraph text="This is some text" alignment="center" /> >> <drawNewLine /> >> <drawParagraph text="#[Date]#" alignment="left" /> >> <drawNewLine /> >> <drawParagraph text="#[FirmName]#" alignment="" /> >> <drawParagraph text="#[AddressLine1]#" alignment="" /> >> <drawParagraph text="#[AddressLine2]#" alignment="" /> >> <drawParagraph text="#[AddressLine3]#" alignment="" /> >> </ITextXMLWrapper> >> >> So here we see that we can set a header, place images, draw blank lines >> and paragraphs (with various alignment options, etc. The #{xxx]# is a >> replacement token. So, what happens is that for each element of the >> data >> List, which is a Map, a new page is begun. The markup above represents >> a >> single page that will be repeated as many times as there elements in the >> List. Then, for each page, the Date, FirmName, AddressLine1, >> AddressLine2 >> and AddressLine3 elements would be retrieve from the Map and inserted >> into >> the generated PDF where the tokens are. >> >> Not rocket science I admit, but the specification of this template >> "language" has grown to be reasonably robust, and can certainly be >> extended further. >> >> So, here's the idea... what if we had a Result class that took an Action >> and used the fields in it as the data for the replacements? That way, a >> developer could simply specify a template, and the PDF would be >> automatically generated from the data in the Action. I could see that >> being rather useful, and I think would help our addoption of SAF2/WW >> here... anyone else see that as potentially useful? Is there perhaps a >> better choice for the template language? Could Freemarker be used in >> this >> way? (I don't know too much about it at the moment). >> >> Thanks! >> >> Frank >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]