in reply to Re: Dynamic text (amount in decimal) not aligned on PDF
in thread Dynamic text (amount in decimal) not aligned on PDF

Thank you RonW and poj! I forgot to mention in my post that am new to Perl (and have started loving it!), so please excuse me for stupid questions. I apologize for posting my complete code, but I want to make sure Monks are able to understand what I intend to do.

RonW I tried using fixed width font but it didn't work. I don't know if I did something wrong.

POJ, I think I partially understood your demo code, and have a question - the advancewidth method would help me in setting the x position of the data field or the width of it?

The code below is the amount field which I want to align right and should get placed under the amount field above it. The text_block method already has -align argument (set to justify) and changing this to right, places the entire text to the right of the page.

The amount fields on my PDF looks like this (a grid)- 400.00 has to right align with 10000.00:
Item Amount 10000.00 Date Deposit 11/17/2014
Amount Delayed 400.00 Amount Delayed 10.00

my $v_pos1 = 140 + $len_item_amt; print $v_pos1."\n\n"; print "len item amt : ".$len_item_amt."\n\n"; print "len amt delayed1: ".$len_amt_delayed1."\n\n"; print "x position: $v_pos1-$len_amt_delayed1"; $left_column_text = $page->text; $left_column_text->font( $font{'Arial'}{'Roman'}, 10 / pt ); $left_column_text->fillcolor('black'); ( $endw, $ypos, $paragraph ) = text_block ( $left_column_text, $amt_delayed1,#'Amount Delayed data:', -x => $v_pos1 - $len_amt_delayed1,#140 , -y => 405,#306,(This is last perfect position) -w => 460,#441.5, -h => 110, -lead => 10 / pt, -parspace => 0 / pt, -align => 'justify', );
Thank you. OSexplorer

Replies are listed 'Best First'.
Re^3: Dynamic text (amount in decimal) not aligned on PDF
by poj (Abbot) on Nov 17, 2014 at 22:08 UTC
    Try this
    # remove these #my $len_item_amt = length $item_amt; #my $len_amt_delayed1 = length $amt_delayed1;#$amt_delayed1; # replace this line # my $v_pos1 = 140 + $len_item_amt; my $w1 = $left_column_text->advancewidth($item_ant); my $w2 = $left_column_text->advancewidth($amt_delayed1); # replace this line # -x => $v_pos1 - $len_amt_delayed1,#140 , -x => 140 + $w1 - $w2;
    poj

      Yaaaaayyyy..it worked!!! Thank you so much poj! I was about to start writing the code to put that complete set of fields into a grid and would have tried aligning the text to the right.

      I am happy I got a drop of Wisdom today..Thank you Perl Monks!

      Thank you. OSexplorer