Hello,

I'm doingt this at the moment, I'm using Velocity (built into the Intrexx
portal server) and a few self made java classes using iText.
Actually, it's quite simply:

In Intrexx, there is a framework which allows me to introduce external java
classes (.jars so to say) into the velocity context. I have no idea how to
do that in clear velocity but it's described in the VTL docs IIRC.

My PDF creation class consists of some methods to add different stuff to the
PDF, like addHeader( String hdr ) which do nothing but pass the content that
should go into the header into private variables of the java object.

There's also a method which initializes the PDF just like always in iText.

In VTL some of my code looks like this (the data is in an array I got from
an SQL DB which doesn't matter atm):

## initialize my object (aka call the constructor)
#set($ausgabe = $PDFGenerator )
#set($basispfad =
"E:\\Xtreme\\org\\intrexx\\external\\htmlroot\\pdfserver\\" )

## put some data in some variable for usage in the pdf
#set( $vorname = $ma_data.get($ma_headers.indexOf( "XVORNAME" )) )
#set( $nachname = $ma_data.get($ma_headers.indexOf( "XNAME" )) )
#set( $telefon = $ma_data.get($ma_headers.indexOf( "XTELEFON" )) )
#set( $telefax = $ma_data.get($ma_headers.indexOf( "XTELEFAX" )) )
#set( $email = $ma_data.get($ma_headers.indexOf( "XEMAIL" )) )

## initialize the PDF object with the path ("$basispfad") where the pdf 
## should be saved and in my case with an article number for the name of the

## pdf. The filename (which is created from the article number and a random
## number within the java object is given back for later use
#set($dateiname = $ausgabe.initLS( $basispfad, $artikelnummer ) )

## put some content into my object
#set($ls3 = $ausgabe.setSachbearbeiter( "$vorname $nachname" ) )
#set($foo = $ausgabe.setEmail( $email ) )
#set($foo = $ausgabe.setTelefon( $telefon ) )
#set($foo = $ausgabe.setTelefax( $telefax ) )

## do the output...
#set($ls4 = $ausgabe.createLS() )

## give the user a nice uri where he/she can download the pdf
<p><a href="http://pdfserver/$dateiname"; target="_blank">$dateiname</a></p>


The last part is IMHO the worst because the pdf is written to a path on the
webserver and a scheduled task clears that path from time to time. If
anybody can come up with a better way, like sending the pdfdirectly to the
browser etc., feel fine to tell me how.

Hope that helps,
cheers,
DD

______________________________________
Dirk Dörflinger  
IT Operator
Telefon +49 (0) 7627 9239 - 230
Telefax +49 (0) 7627 9239 - 100
H2O GmbH process water engineering
Wiesenstrasse 32
79585 Steinen/ Germany
www.h2o-gmbh.com
______________________________________ 
Clevere Ideen für sauberes Wasser!
______________________________________ 
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:itext-questions-
> [EMAIL PROTECTED] Im Auftrag von Dilan
> Gesendet: Donnerstag, 22. September 2005 03:56
> An: itext-questions@lists.sourceforge.net
> Betreff: [iText-questions] RE: generating pdf through the Velocity
> 
> Hello,
> Im wondering, if anyone have done any program to output pdf from the
> http://jakarta.apache.org/velocity/
> if there is, can you  able to help me through how it works or some example
> codes regards this,
> 
> thanks
> dilan
> 
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
BEGIN:VCARD
VERSION:2.1
N:Dörflinger;Dirk
FN:Dirk Dörflinger ([EMAIL PROTECTED])
ORG:H2O GmbH
TITLE:IT-Operator
TEL;WORK;VOICE:+49 7627-9239-230
TEL;WORK;FAX:+49 7627-9239-200
ADR;WORK:;;Wiesenstrasse 32;Steinen;;79585;Deutschland
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:Wiesenstrasse 32=0D=0ASteinen 79585=0D=0ADeutschland
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20050714T065302Z
END:VCARD

Reply via email to