Problems with PDF invoice

I have created a pdf application using SC that print invoices.
My problem is that my application can generate only pdf with one 1 products.
How do i add multiple products on the invoice with automatic addition to produuce total.
i know there is a sample there but i really don’t understand it.
I really hope some one will guide me to the correct path.