You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "G.L. Grobe" <ga...@grobe.net> on 2002/05/02 07:46:18 UTC

iters in foreach again

Is there anyway to iterate through two vectors withing the same #foreach loop in velocity? I saw the previous thread on this w/ subject line 'Proposal: #foreach(iter1, iter2) and some of it was *I think* what I needed, but didn't understand where it left off. Or if there's currently another functional way to do the following ...

Ex.

#foreach ($col1 in $columnA and $col2 in columnB)
<td>$col1.name</td>
<td>$col2.time</td>
#end

TIA,

Re: Generating PDF - this way?

Posted by Jason van Zyl <jv...@zenplex.com>.
On Fri, 2002-05-31 at 05:24, Attila Szegedi wrote:
> iText rocks. It's probably uncool to say this on an Apache mailing list, but
> iText leaves FOP in the dust.

Not uncool at all :-) We use iText in Tambora and it's great. I actually
avoid any and all 'standard' XML technologies where possible ;-)

 A critical aspect for me (being a Hungarian)
> is that iText will handle non US-ASCII characters correctly (no surprise,
> its authors are non-English...), while FOP was a major PITA on this
> aspect...
> 
> Cheers,
>   Attila.
> 
> --
> Attila Szegedi
> home: http://www.szegedi.org
> 
> 
> ----- Original Message -----
> From: "Terry Steichen" <te...@net-frame.com>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: 2002. május 31. 0:23
> Subject: Re: Generating PDF - this way?
> 
> 
> > Try http://www.lowagie.com/iText/
> >
> > Regards,
> >
> > Terry
> > ----- Original Message -----
> > From: "Saimon Moore" <sa...@yahoo.co.uk>
> > To: "Velocity Users List" <ve...@jakarta.apache.org>
> > Sent: Thursday, May 30, 2002 6:29 PM
> > Subject: Re: Generating PDF - this way?
> >
> >
> > > I generate pdfs with velocity which generates an xml file with tags
> > > specific to the iText (www.itext.org) library and then use that to
> > > generate the pdfs...
> > > try it out...simple and works great ....
> > >
> > > Saimon
> > >
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://tambora.zenplex.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generating PDF - this way?

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 5/31/02 5:24 AM, "Attila Szegedi" <sz...@freemail.hu> wrote:

> iText rocks. It's probably uncool to say this on an Apache mailing list, but
> iText leaves FOP in the dust.

Not uncool at all.  It's good to know about alternatives.  I use as much
apache software as possible, but I will certainly look at it.

And I think it's a great thing that no one needs the work! :)


> A critical aspect for me (being a Hungarian)
> is that iText will handle non US-ASCII characters correctly (no surprise,
> its authors are non-English...), while FOP was a major PITA on this
> aspect...
> 
> Cheers,
> Attila.
> 
> --
> Attila Szegedi
> home: http://www.szegedi.org
> 
> 
> ----- Original Message -----
> From: "Terry Steichen" <te...@net-frame.com>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: 2002. május 31. 0:23
> Subject: Re: Generating PDF - this way?
> 
> 
>> Try http://www.lowagie.com/iText/
>> 
>> Regards,
>> 
>> Terry
>> ----- Original Message -----
>> From: "Saimon Moore" <sa...@yahoo.co.uk>
>> To: "Velocity Users List" <ve...@jakarta.apache.org>
>> Sent: Thursday, May 30, 2002 6:29 PM
>> Subject: Re: Generating PDF - this way?
>> 
>> 
>>> I generate pdfs with velocity which generates an xml file with tags
>>> specific to the iText (www.itext.org) library and then use that to
>>> generate the pdfs...
>>> try it out...simple and works great ....
>>> 
>>> Saimon
>>> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generating PDF - this way?

Posted by Attila Szegedi <sz...@freemail.hu>.
iText rocks. It's probably uncool to say this on an Apache mailing list, but
iText leaves FOP in the dust. A critical aspect for me (being a Hungarian)
is that iText will handle non US-ASCII characters correctly (no surprise,
its authors are non-English...), while FOP was a major PITA on this
aspect...

Cheers,
  Attila.

--
Attila Szegedi
home: http://www.szegedi.org


----- Original Message -----
From: "Terry Steichen" <te...@net-frame.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: 2002. május 31. 0:23
Subject: Re: Generating PDF - this way?


> Try http://www.lowagie.com/iText/
>
> Regards,
>
> Terry
> ----- Original Message -----
> From: "Saimon Moore" <sa...@yahoo.co.uk>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Thursday, May 30, 2002 6:29 PM
> Subject: Re: Generating PDF - this way?
>
>
> > I generate pdfs with velocity which generates an xml file with tags
> > specific to the iText (www.itext.org) library and then use that to
> > generate the pdfs...
> > try it out...simple and works great ....
> >
> > Saimon
> >


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generating PDF - this way?

Posted by Terry Steichen <te...@net-frame.com>.
Try http://www.lowagie.com/iText/

Regards,

Terry
----- Original Message -----
From: "Saimon Moore" <sa...@yahoo.co.uk>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Thursday, May 30, 2002 6:29 PM
Subject: Re: Generating PDF - this way?


> I generate pdfs with velocity which generates an xml file with tags
> specific to the iText (www.itext.org) library and then use that to
> generate the pdfs...
> try it out...simple and works great ....
>
> Saimon
>
> Geir Magnusson Jr. wrote:
>
> >Sounds reasonable.  However, typing all that fo: stuff would get tedious.
> >
> >It would be great to have a PDF/FOP VM lib.  I would really like to have
> >this in DVSL (and willing to pay someone to work on it - if interested,
> >contact me privately...)
> >
> >Geir
> >
> >
> >On 5/30/02 4:00 PM, "Peter Romianowski" <me...@gmx.de> wrote:
> >
> >
> >
> >>Hi there,
> >>
> >>I just wanted to verify that I am not doing something
> >>really weird. I generate PDFs using Velocity and apache's
> >>FOP (from xml.apache.org). First I use Velocity to create
> >>the FO-Input for the FOP.
> >>A template would look like this:
> >>
> >>... fop stuff ...
> >>
> >><fo:block font-size="18pt"
> >>        font-family="sans-serif"
> >>        line-height="24pt"
> >>        space-after.optimum="15pt"
> >>        background-color="blue"
> >>        color="white"
> >>        text-align="center"
> >>        padding-top="3pt">
> >>
> >>  #if ($age >= 18)
> >>      Welcome $salutation $lastname
> >>  #else
> >>      Sorry, lad.
> >>  #end
> >></fo:block>
> >>
> >>... fop ...
> >>
> >>This I render to a StringWriter with Velocity and using
> >>the result as Input for the FOP, which then generates
> >>the PDF.
> >>
> >>The great benefit for me is that I can use velocity :)
> >>Are there other ways to create PDFs using velocity?
> >>The speed is ok.
> >>
> >>
> >
> >
> >
> >
>
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generating PDF - this way?

Posted by Saimon Moore <sa...@yahoo.co.uk>.
I generate pdfs with velocity which generates an xml file with tags 
specific to the iText (www.itext.org) library and then use that to 
generate the pdfs...
try it out...simple and works great ....

Saimon

Geir Magnusson Jr. wrote:

>Sounds reasonable.  However, typing all that fo: stuff would get tedious.
>
>It would be great to have a PDF/FOP VM lib.  I would really like to have
>this in DVSL (and willing to pay someone to work on it - if interested,
>contact me privately...)
>
>Geir
>
>
>On 5/30/02 4:00 PM, "Peter Romianowski" <me...@gmx.de> wrote:
>
>  
>
>>Hi there,
>>
>>I just wanted to verify that I am not doing something
>>really weird. I generate PDFs using Velocity and apache's
>>FOP (from xml.apache.org). First I use Velocity to create
>>the FO-Input for the FOP.
>>A template would look like this:
>>
>>... fop stuff ...
>>
>><fo:block font-size="18pt"
>>        font-family="sans-serif"
>>        line-height="24pt"
>>        space-after.optimum="15pt"
>>        background-color="blue"
>>        color="white"
>>        text-align="center"
>>        padding-top="3pt">
>>
>>  #if ($age >= 18)
>>      Welcome $salutation $lastname
>>  #else
>>      Sorry, lad.
>>  #end
>></fo:block>
>>
>>... fop ...
>>
>>This I render to a StringWriter with Velocity and using
>>the result as Input for the FOP, which then generates
>>the PDF.
>>
>>The great benefit for me is that I can use velocity :)
>>Are there other ways to create PDFs using velocity?
>>The speed is ok.
>>    
>>
>
>
>  
>




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Generating PDF - this way?

Posted by Paulo Gaspar <pa...@krankikom.de>.
Last time I looked I found it to be too easy to pay someone else to do it.

I made a test for my job on using Velocity (not DVSL) to generate PDFs via
FOP and it was quite easy to have it working. You will probably find out how
to do it in the time it would take you to negociate and manage such thing.


Have fun,
Paulo Gaspar

> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@adeptra.com]
> Sent: Thursday, May 30, 2002 10:06 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Generating PDF - this way?
>
>
> Sounds reasonable.  However, typing all that fo: stuff would get tedious.
>
> It would be great to have a PDF/FOP VM lib.  I would really like to have
> this in DVSL (and willing to pay someone to work on it - if interested,
> contact me privately...)
>
> Geir
>
>
> On 5/30/02 4:00 PM, "Peter Romianowski" <me...@gmx.de> wrote:
>
> > Hi there,
> >
> > I just wanted to verify that I am not doing something
> > really weird. I generate PDFs using Velocity and apache's
> > FOP (from xml.apache.org). First I use Velocity to create
> > the FO-Input for the FOP.
> > A template would look like this:
> >
> > ... fop stuff ...
> >
> > <fo:block font-size="18pt"
> >         font-family="sans-serif"
> >         line-height="24pt"
> >         space-after.optimum="15pt"
> >         background-color="blue"
> >         color="white"
> >         text-align="center"
> >         padding-top="3pt">
> >
> >   #if ($age >= 18)
> >       Welcome $salutation $lastname
> >   #else
> >       Sorry, lad.
> >   #end
> > </fo:block>
> >
> > ... fop ...
> >
> > This I render to a StringWriter with Velocity and using
> > the result as Input for the FOP, which then generates
> > the PDF.
> >
> > The great benefit for me is that I can use velocity :)
> > Are there other ways to create PDFs using velocity?
> > The speed is ok.
>
>
> --
> Geir Magnusson Jr.
> Research & Development, Adeptra Inc.
> geirm@adeptra.com
> +1-203-247-1713
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generating PDF - this way?

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
Sounds reasonable.  However, typing all that fo: stuff would get tedious.

It would be great to have a PDF/FOP VM lib.  I would really like to have
this in DVSL (and willing to pay someone to work on it - if interested,
contact me privately...)

Geir


On 5/30/02 4:00 PM, "Peter Romianowski" <me...@gmx.de> wrote:

> Hi there,
> 
> I just wanted to verify that I am not doing something
> really weird. I generate PDFs using Velocity and apache's
> FOP (from xml.apache.org). First I use Velocity to create
> the FO-Input for the FOP.
> A template would look like this:
> 
> ... fop stuff ...
> 
> <fo:block font-size="18pt"
>         font-family="sans-serif"
>         line-height="24pt"
>         space-after.optimum="15pt"
>         background-color="blue"
>         color="white"
>         text-align="center"
>         padding-top="3pt">
> 
>   #if ($age >= 18)
>       Welcome $salutation $lastname
>   #else
>       Sorry, lad.
>   #end
> </fo:block>
> 
> ... fop ...
> 
> This I render to a StringWriter with Velocity and using
> the result as Input for the FOP, which then generates
> the PDF.
> 
> The great benefit for me is that I can use velocity :)
> Are there other ways to create PDFs using velocity?
> The speed is ok.


-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Generating PDF - this way?

Posted by Peter Romianowski <me...@gmx.de>.
Hi there,

I just wanted to verify that I am not doing something
really weird. I generate PDFs using Velocity and apache's 
FOP (from xml.apache.org). First I use Velocity to create 
the FO-Input for the FOP.
A template would look like this:

... fop stuff ...

<fo:block font-size="18pt" 
          font-family="sans-serif" 
          line-height="24pt"
          space-after.optimum="15pt"
          background-color="blue"
          color="white"
          text-align="center"
          padding-top="3pt">

    #if ($age >= 18)
        Welcome $salutation $lastname
    #else
        Sorry, lad.
    #end
</fo:block>

... fop ...

This I render to a StringWriter with Velocity and using
the result as Input for the FOP, which then generates
the PDF.

The great benefit for me is that I can use velocity :)
Are there other ways to create PDFs using velocity?
The speed is ok.

cheers,
Peter


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: iters in foreach again

Posted by Bill Burton <bi...@progress.com>.
Hello Gary,

Since I've seen you post to the WebWork-User list, I'll assume you're
using WebWork.

WebWork has several utility classes for dealing with
Iterators--AppendIteratorFilter, IteratorGenerater, MergeIteratorFilter,
SortIteratorFilter and SubsetIteratorFilter.  The MergeIteratorFilter
appears like it would do what you want.

Using the WebWork Velocimacros, you could call it like this (untested):

  ## Initialize a MergeIteraterFilter instance
  #action("MergeIteratorFilter" $colsmerged)
  #set( $dummy = $colsmerged.setSource($columnA) )
  #set( $dummy = $colsmerged.setSource($columnB) )
  #execute($colmerged)

  ## Iterate over merged columns
  #foreach ($col in $colsmerged)
    ## Not sure if the references below are correct
    <td>$col.name</td>
    <td>$col.time</td>
  #end

Hope this helps,
-Bill
 
"G.L. Grobe" wrote:
> 
> Is there anyway to iterate through two vectors withing the same #foreach loop in velocity? I saw the previous thread on this w/ subject line 'Proposal: #foreach(iter1, iter2) and some of it was *I think* what I needed, but didn't understand where it left off. Or if there's currently another functional way to do the following ...
> 
> Ex.
> 
> #foreach ($col1 in $columnA and $col2 in columnB)
> <td>$col1.name</td>
> <td>$col2.time</td>
> #end
> 
> TIA,

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: iters in foreach again

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 5/2/02 1:46 AM, "G.L. Grobe" <ga...@grobe.net> wrote:

> Is there anyway to iterate through two vectors withing the same #foreach loop
> in velocity? I saw the previous thread on this w/ subject line 'Proposal:
> #foreach(iter1, iter2) and some of it was *I think* what I needed, but didn't
> understand where it left off. Or if there's currently another functional way
> to do the following ...
> 
> Ex.
> 
> #foreach ($col1 in $columnA and $col2 in columnB)
> <td>$col1.name</td>
> <td>$col2.time</td>
> #end
> 
> TIA,
> 


Yes - we didn't resolve.  The #foreach(... , ... , ...)  was sort of
compelling (elegant syntax) but there will be problems that will arise in
doing such a thing.

You can easily write yourself (or we can find one that we did before) a tool
that does this for you.  I have one somewhere.  I'll find it and put it
somewhere...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Java : the speed of Smalltalk with the simple elegance of C++... 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>