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]