# Ugh - label printing

**URL:** <https://www.ruby-forum.com/t/ugh-label-printing/73805>\
**Category:** Rails\
**Created:** [October 27, 2006, 5:56am UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805 "2006-10-27T05:56:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 27, 2006, 5:56am UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805/1 "2006-10-27T05:56:59Z")

</div>

I have a ‘Library’ module where I am going to have to print apparently 5  
different types of labels depending upon whether they are for books,  
cd’s, audio tapes, video tapes, etc.

Is anyone printing labels with Rails?

Anyone have any suggestions for doing this?

As I see it, I can either export the data as CSV and use that CSV to  
mail merge with Word/OpenOffice.org or beat myself up trying to make it  
work out with pdf-writer.

I am hoping that someone has blazed this trail already…googling hasn’t  
turned up anything of significance.

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 27, 2006, 12:01pm UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805/2 "2006-10-27T12:01:20Z")

</div>

If you don’t mind MS Word, you could go WordML and generate XML via  
Builder - surprisingly viable out in the real world - we use it at work  
to generate orchestra schedules dynamically… (not RoR… yet)

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 27, 2006, 12:21pm UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805/3 "2006-10-27T12:21:22Z")

</div>

Craig W. wrote:

> I have a ‘Library’ module where I am going to have to print apparently 5  
> different types of labels depending upon whether they are for books,  
> cd’s, audio tapes, video tapes, etc.
> 
> Is anyone printing labels with Rails?

No, but I’m at the same point you are.

> Anyone have any suggestions for doing this?
> 
> As I see it, I can either export the data as CSV and use that CSV to  
> mail merge with Word/OpenOffice.org or beat myself up trying to make it  
> work out with pdf-writer.

It does make sense to leverage the label functionality in the word  
processor, if one can get the data in there in the first place.

> I am hoping that someone has blazed this trail already…googling hasn’t  
> turned up anything of significance.

Indeed. I originally though about generating XML from Rails and  
importing it into OOo, but now I’m currently looking at ODBC or JDBC as  
a dynamic interface between Rails and OOo. I’m so new to Rails it’s all  
a bit painful at the moment, but will keep plugging away.

–  
Antony G. | Open Source Consultancy  
Wayforth | Software Development  
020 7247 1011 | Website Design  
[http://www.wayforth.co.uk](http://www.wayforth.co.uk) | Peace-of-mind Support

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 27, 2006, 1:41pm UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805/4 "2006-10-27T13:41:28Z")

</div>

Antony G. wrote:

> Indeed. I originally though about generating XML from Rails and  
> importing it into OOo, but now I’m currently looking at ODBC or JDBC as  
> a dynamic interface between Rails and OOo. I’m so new to Rails it’s all  
> a bit painful at the moment, but will keep plugging away.

Scrap that, my head wasn’t there. It seems that the ActiveRecord  
[O|J]DBC connectors allow Rails to use external databases, but don’t  
expose the Rails DB to others. However, I don’t see why I can’t just  
link OOo to my mysql Rails backend. Trying this now…

–  
Antony G. | Open Source Consultancy  
Wayforth | Software Development  
020 7247 1011 | Website Design  
[http://www.wayforth.co.uk](http://www.wayforth.co.uk) | Peace-of-mind Support

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 27, 2006, 4:01pm UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805/5 "2006-10-27T16:01:42Z")

</div>

Craig W. wrote:

> I have a ‘Library’ module where I am going to have to print apparently 5  
> different types of labels depending upon whether they are for books,  
> cd’s, audio tapes, video tapes, etc.
> 
> Is anyone printing labels with Rails?
> 
> Anyone have any suggestions for doing this?

Hi,

not with Rails (yet), but with PHP (the application I’m trying to port).

I have PHP create a temporary LaTeX file and then run “pdflatex” to  
compile  
this file to a PDF on the server, then have PHP pass it through to the  
browser as application/x-pdf. It’s so simple that it’s a ten-liner even  
in  
PHP. _g_

There are lots of pre-made classes especially for the myriad of  
different  
Zweckform sticky labels available for LaTeX, including margin settings  
for  
most common printers. You’re bound to find labels for CDs and DVDs and  
the  
like too, otherwise you can modify an existing class rather easily.

I came to the conclusion that this is the easiest method. You don’t  
depend  
on the users’ Word or OOo versions, they can view it before they print  
it,  
adjust printer settings if they want, or just save the file. Plus, the  
user  
can’t break anything.

–  
Jens

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 27, 2006, 6:13pm UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805/6 "2006-10-27T18:13:58Z")

</div>

On Fri, 2006-10-27 at 15:26 +0200, Jens wrote:

> Zweckform sticky labels available for LaTeX, including margin settings for  
> most common printers. You’re bound to find labels for CDs and DVDs and the  
> like too, otherwise you can modify an existing class rather easily.
> 
> I came to the conclusion that this is the easiest method. You don’t depend  
> on the users’ Word or OOo versions, they can view it before they print it,  
> adjust printer settings if they want, or just save the file. Plus, the user  
> can’t break anything.

* * *

I am real interested in this. Obviously this isn’t going to use  
pdf-writer since the output must go to latex for processing but it does  
make sense.

If you make any progress, please post up.

Search for latex on rubyforge wasn’t all that encouraging but there is  
one gem called latex.

Thanks

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [October 27, 2006, 7:40pm UTC](https://www.ruby-forum.com/t/ugh-label-printing/73805/7 "2006-10-27T19:40:09Z")

</div>

Craig W. wrote:

> > > Anyone have any suggestions for doing this?  
> > > There are lots of pre-made classes especially for the myriad of different  
> > > pdf-writer since the output must go to latex for processing but it does  
> > > make sense.
> 
> If you make any progress, please post up.
> 
> Search for latex on rubyforge wasn’t all that encouraging but there is  
> one gem called latex.
> 
> Thanks
> 
> Craig

I’m not that familiar with latex, but if you can call it from the  
command line, you could use the backtick to invoke it and then pick up  
the pdf file when it was done. You may not need any ruby bindings  
around this…

\_Kevin
