Re: [lajug] printing mailing labels

Lane Sharman <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
Hi Stephane,

I understand what you are up against. You are looking almost for an 
avery datafile of metrics in Java.

Here is what I would do. Create a file of bean specs and then evaluate 
the file at run time:
## file of predefined avery specs
##8999 defined:
#bean $MailingSpecs = "java.util.HashMap"
#bean $MailingLabel = "com.waytooeasy.MailingLabel" onNew  {
   #set $MailingLabel.ID = "8999"
   #set $MailingLabel.Manufacturer="Avery"
   #set $MailingLabel.Across= 3
   #set $MailingLabel.Down= 10
   #set $MailingLabel.TopMargin= .8
   #set $MailingLabel.LeftMargin= .8
   #set $MailingLabel.Height= 1.75
   #set $MailingLabel.Width= 2.80
}
#set $tmp = $MailingSpecs.put($MailingLabel.ID, $MailingLabel)
## more specs

When this file is evaluated at run time, you will have in your WM 
"context", a HashMap which has all your specs:

HashMap specs = (HashMap) context.get("MailingSpecs");
MailingLabel label = (MailingLabel) specs.get("8999");

see http://webmacro.org/BeanDirective for more insight on this.

I have been doing this for years in all my applications. You can get 
more creative and store the original spec in a database and allow the 
user to create a spec using your Swing GUI.

In short, you work directly with a Java object in your text file of your 
own making. This idiom is accepted in the WebMacro community. It is 
definitely worth giving it a try if I understand what you are trying to 
accomplish.

-Lane



Stephane Grenier wrote:

>Thank you both for your replies, it is appreciated.
>Let me get a little more precise to see if anyone can
>come up with other alternative options.
>
>One requirement is that it is embedded 100% in the
>java code. That is, either it references a jar or
>class files, not an external application (our product
>is a standalong java swing application). Therefore I
>cannot assume that the end user will have MS Word or
>any other program because this creates a dependency
>between our application and having the printing
>application available (for example MS Word).
>
>In regards to using frameworks to print it, we already
>use a tool called JFreeReport that can do all the work
>for us. What I'm trying to avoid doing is finding and
>implementing all the measurements of the different
>Avery stationary label packages (for example avery
>xxxx means labels are x by y for 30 labels per sheet,
>etc.). There are many different avery packages that
>you can buy and I don't want to have to create a
>different report for each one (hence why we don't mind
>paying for a company that provides runtime libraries).
>Otherwise it looks like we'll have to manually pick a
>few packages and create reports for those.
>
>Thank you again,
>Stephane
>
>
>
>--- Lane Sharman <[email protected]> wrote:
>  
>
>>just use a template engine like WebMacro or
>>Velocity.
>>
>>these are swiss-army knives for precise merging of
>>records into a text 
>>output document such as a 10 up.
>>
>>-Lane
>>
>>Stephane Grenier wrote:
>>
>>    
>>
>>>Hello,
>>>
>>>Does anyone know of a good framework (preferably
>>>      
>>>
>>open
>>    
>>
>>>source) for printing mailing labels, such as Avery
>>>mailing labels?
>>>
>>>Regards,
>>>Stephane
>>>
>>>
>>>		
>>>__________________________________ 
>>>Do you Yahoo!? 
>>>Yahoo! Small Business - Try our new resources site!
>>>http://smallbusiness.yahoo.com/resources/
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>    
>>
>>>To unsubscribe, e-mail: [email protected]
>>>For additional commands, e-mail:
>>>      
>>>
>>[email protected]
>>    
>>
>>> 
>>>
>>>      
>>>
>>-- 
>>Lane Sharman
>>Providing Private and SPAM-Free Email
>>http://www.opendoors.com
>>858-755-2868
>>
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail: [email protected]
>>For additional commands, e-mail:
>>[email protected]
>>
>>
>>    
>>
>
>
>		
>__________________________________ 
>Do you Yahoo!? 
>Yahoo! Small Business - Try our new resources site!
>http://smallbusiness.yahoo.com/resources/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>
>  
>

-- 
Lane Sharman
Providing Private and SPAM-Free Email
http://www.opendoors.com
858-755-2868
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.