#!/usr/local/bin/perl -w use strict; use PDF::Create; use Encode qw( _utf8_on ); my( $string ) = @ARGV; _utf8_on( $string ); die "usage: $0 string" if !defined $string; my $pdf = PDF::Create->new( filename => 'label.pdf' ); my $width = 144; my $height = 54; my $font_size = 20 / length( $string ) * 11; my $adjust = $font_size/7; my $page = $pdf->new_page( 'MediaBox' => [ 0, 0, $width, $height ] ); my $f1 = $pdf->font( Subtype => 'Type1', Encoding => 'WinAnsiEncoding', BaseFont => 'Helvetica' ); $page->stringc( $f1, $font_size, $width/2 + 10, ($height - $font_size)/2 + $adjust, $string ); $pdf->close; system( "acroread label.pdf" );