#!/usr/bin/perl use strict; use warnings; use PTouchOut; use Text::ASCIITable::Wrap qw/wrap/; use GD; use Getopt::Long qw/:config auto_help gnu_getopt bundling/; use Pod::Usage; use GdUtil qw/:all/; use PTouch qw/pixels PIX_PER_MM/; GetOptions( PTouchOut->opts, PTouchOut->opts_code, ) or die "invalid options"; while(<>) { /^\d+\s+(\w+)\s+(.*?)\s*$/ or next; my ($code,$text) = ($1,$2); $text =~ s/ +/ /g; print "($code) ($text)\n"; my $qc = PTouchOut->code("http://www.mcmaster.com/#$code"); for(my $c = 1; $c++; 1) { my $r = wrap($text,$c); if (scalar (split /\n/, $r) <= 3) { PTouchOut->outputs(hcat($qc,drawtext($r))); last; } } } #my $height = PTouchOut->pixels; #my $text = "mcmaster"; #my @lines = split /\s*\r?\n\s*/, $text; #my $tgd = hcat(PTouchOut->code("Pickles!"), vcat(map { drawtext($_) } @lines)); #PTouchOut->output(crop_centered($tgd,undef, $height)); __END__ =head1 SYNOPSIS Options: --help brief help message -w n specify tape width in mm -o