how to auto create pdf on demand

I'm interested in building pdf's automatically on demand.... [just want to learn]

as for example what i want:
for example i have ticked server
someone buys ticket and i send him email with pdf to print...
how to generate pdf?
There are a lot of ways, but the most prominent is probably the pdflib bundle, which can work with almost any programming language. I personally use it with php programming. There is both a commercial version and a "lite" free version. As you want to learn, my guess would be to start to use the lite version that you can find in the ports tree(print/pdflib). More info on the commercial version can be found here: