LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-11-2006, 08:45 PM   #1
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 329

Rep: Reputation: 30
Avery 05259 from mySQL


Hey,

I have just purchased a package of Avery 05259 labels and I need to print about 100 unique addresses and 100 identical address (200 total).

The addresses are all in a mySQL database in a simple table where I could do select `addresse` from `addresses` where `final`='y'.

What is the easiest way to get the addresses from my database to the printer in the proper format for the given labels?

Thanks,

David
 
Old 02-12-2006, 12:20 PM   #2
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
I'd write a Python script to get the data out of the db. Maybe something like:
Code:
#!/usr/bin/python

import MySQLdb
connection = MySQLdb.connect( user="some_user", passwd="some_passw0rd", db="my_address_db" )
cursor = connection.cursor()
cursor.execute( 'select * from addresses where final="y"' )
results = cursor.fetchall()
for result in results:
    print result
connection.close()
If you fiddled around with formatting and spaces, you might be able to print
out columns and get it to come out right (a plain text file).

For something fancier though, I'd probably use a pdf library like reportlab
( http://www.reportlab.org/rl_toolkit.html ) to create a pdf on the fly
(instead of just printing out the results as plain text).

Another option might be to have your script spit out html, then convert
that html to a pdf (with some control over how the pdf gets formatted) using
htmldoc ( http://www.easysw.com/htmldoc/ ).

Last edited by johnMG; 02-12-2006 at 01:01 PM.
 
Old 02-12-2006, 01:11 PM   #3
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
Or you could produce TeX output, then process that into a pdf using tex2pdf.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
Avery CD Label OO.org Templates has UK codes. WTF! AvatarofVirgo Linux - General 5 12-16-2005 07:02 PM
Avery Label Printer noeffred Linux - Hardware 0 12-01-2005 01:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration