This shows you the differences between the selected revision and the current version of the page.
| auto.flow 2007/08/21 20:08 | auto.flow 2007/08/23 15:46 current | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| Illustrates "autoflow", or the way that text extends lines & pages. | Illustrates "autoflow", or the way that text extends lines & pages. | ||
| - | #!/usr/bin/perl | + | <code perl> |
| + | #!/usr/bin/perl | ||
| + | |||
| + | use PDF::API2::Simple; | ||
| + | |||
| + | my $pdf = PDF::API2::Simple->new( | ||
| + | file => '03_autoflow.pdf', | ||
| + | line_height => 20, | ||
| + | margin_left => 5, | ||
| + | margin_top => 5, | ||
| + | margin_right => 5, | ||
| + | margin_bottom => 5 | ||
| + | ); | ||
| + | |||
| + | $pdf->add_font('VerdanaBold'); | ||
| + | $pdf->add_font('Verdana'); | ||
| + | $pdf->add_page(); | ||
| - | use PDF::API2::Simple; | + | $pdf->next_line; |
| - | my $pdf = PDF::API2::Simple->new( | + | $pdf->text( 'Demonstrating Text', |
| - | file => '03_autoflow.pdf', | + | x => ($pdf->width / 2), |
| - | line_height => 20, | + | font => 'VerdanaBold', |
| - | margin_left => 5, | + | font_size => 12, |
| - | margin_top => 5, | + | align => 'center' ); |
| - | margin_right => 5, | + | |
| - | margin_bottom => 5 | + | |
| - | ); | + | |
| - | $pdf->add_font('VerdanaBold'); | + | $pdf->set_font( 'Verdana' ); |
| - | $pdf->add_font('Verdana'); | + | |
| - | $pdf->add_page(); | + | |
| - | + | ||
| - | $pdf->next_line; | + | |
| - | + | ||
| - | $pdf->text( 'Demonstrating Text', | + | |
| - | x => ($pdf->width / 2), | + | |
| - | font => 'VerdanaBold', | + | |
| - | font_size => 12, | + | |
| - | align => 'center' ); | + | |
| - | + | ||
| - | $pdf->set_font( 'Verdana' ); | + | |
| - | + | ||
| - | $pdf->next_line; | + | |
| - | $pdf->next_line; | + | |
| - | + | ||
| - | for (my $i = 0; $i < 250; $i++) { | + | |
| - | my $text = "$i - All work and no play makes Jack a dull boy"; | + | |
| - | + | ||
| - | $pdf->text($text, autoflow => 'on'); | + | |
| - | } | + | |
| - | + | ||
| - | $pdf->save(); | + | |
| + | $pdf->next_line; | ||
| + | $pdf->next_line; | ||
| + | |||
| + | for (my $i = 0; $i < 250; $i++) { | ||
| + | my $text = "$i - All work and no play makes Jack a dull boy"; | ||
| + | |||
| + | $pdf->text($text, autoflow => 'on'); | ||
| + | } | ||
| + | |||
| + | $pdf->save(); | ||
| + | </code> | ||