How to print mailing labels in columns 
Author Message
 How to print mailing labels in columns

-----BEGIN PGP SIGNED MESSAGE-----

I've been looking for an easy way to print mailing labels in columns.
Formats won't do it, and Array::PrintCols won't do it.  Does anyone
have any suggestions?

Many thanks (please cc replies by email).

- --

SIG of the day: [ ] Contact  [ ] Web  [ ] PGP  [x] Taglines #1  [ ] #2
Reality is for those who can't face science fiction. | Power corrupts;
absolute power is kind of neat. | "It's in Tibetan!" - The Doctor (5G)
"A lawyer is like a river." - Kosh | Life is like a simile | Dynsdale!

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.0.2i

iQB1AwUBN0YXmL/mBljD2JABAQHVcwMAr/m3eFXtzAnfmxKmUSBP7QDQrXdA7RDZ
n91+bzwxXcKAl2lYAvRIArPSTr0IJUsGr24n6MbhGSc+8Sj6EDHsmOwKSeZd8j+7
firfpXaSz5pW1twsna4YviUt94/Y7KAS
=PChI
-----END PGP SIGNATURE-----



Wed, 07 Nov 2001 03:00:00 GMT  
 How to print mailing labels in columns
[ courtesy cc sent by mail if address not munged ]

Quote:

>I've been looking for an easy way to print mailing labels in columns.
>Formats won't do it, and Array::PrintCols won't do it.  Does anyone
>have any suggestions?

Why won't format work?

This is the kind of thing "format" is made for.

perldoc -f format

Or  take a look at the docs for the printf function.

perldoc -f printf

HTH



Wed, 07 Nov 2001 03:00:00 GMT  
 How to print mailing labels in columns
Sorry I should have tried harder before posting to the list: I thought it
would be harder to do with formats than it was:

while ( $count <= $rv ) { # $rv is the total number of records
$twice = "";
while ( $twice < 2 ) {

$name[$twice] = "$member{title} $member{first} $member{last}";
$address[$twice] = $member{street};
$address2[$twice] = "$member{suburb} $member{state} $member{post_code}";
$twice++;

Quote:
}

write (STDOUT) }




$address2[0], $address2[1]

.

--

SIG of the day: [ ] Contact  [ ] Web  [ ] PGP  [x] Taglines #1  [ ] #2
Reality is for those who can't face science fiction. | Power corrupts;
absolute power is kind of neat. | "It's in Tibetan!" - The Doctor (5G)
"A lawyer is like a river." - Kosh | Life is like a simile | Dynsdale!



Wed, 07 Nov 2001 03:00:00 GMT  
 How to print mailing labels in columns

Quote:

> I've been looking for an easy way to print mailing labels in columns.
> Formats won't do it, and Array::PrintCols won't do it.  Does anyone
> have any suggestions?

I assume you're talking about printing on label sheets where you have
a number across the page right ?

The trick is that you need to build up your print line to contain the
requisite number of items across and as you have noticed formats dont
cut it easily.

Anyhow as strangely Perl is possibly the only language I have used that
I havent done this task in here it is (using my old standby data - you
will need to alter that bit to suit ).

#!/usr/bin/perl -w

use strict;


open(DATA,"phonebook.txt") || die "Cant open data - $!\n";

my $width    = 30 ;  # characters between left margin of labels
my $across   = 3 ;   # Labels across the sheet
my $vertical = 5;    # Lines between labels
my $lmargin  = 5;    # Left margin width of sheet in characters

while(<DATA>)
{

  chomp;

  my ( $surname,
       $forename,
       $title,
       $number,
       $location,
       $dept ) = split /,/,$_ ;

  my $fullname = "$forename $surname";

  $line[0] .= sprintf("%-${width}s",$fullname);
  $line[1] .= sprintf("%-${width}s",$title);
  $line[2] .= sprintf("%-${width}s",$dept);
  $line[3] .= sprintf("%-${width}s",$location);

  if (++$count == $across )
    {

       {
         print " " x $lmargin,$_,"\n";
         $_ = "";
       }
     print "\n" x $vertical;
     $count = 0;
    }

Quote:
}

/J\
--

Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


Wed, 07 Nov 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Printing mailing labels?

2. Using guestbookscript for printing labels.

3. Using guestbookscript for printing labels.

4. printing labels

5. help-print using labels gives error (update)

6. help-print using labels gives error

7. automatically pretty print columns of data

8. How to print file in two columns ?

9. printing a two column sorted HTML table

10. msql perl print columns

11. print a hash with 2 columns

12. next label not reported as a bad label in BLOCK

 

 
Powered by phpBB® Forum Software