use strict; use warnings; use PDF::API2; my $pdf = PDF::API2-> new; my $page = $pdf-> page; my $font = $pdf-> corefont( 'Helvetica' ); my $content = $page-> text; $content-> font( $font, 16 ); $content-> fillcolor( '#000000' ); $content-> translate( 50, 620 ); $content-> text( 'Print some text' ); $content = $page-> gfx; $content-> rect( 50, 560, 400, 18 ); $content-> fillcolor( '#000000' ); $content-> fill; $content = $page-> text; $content-> font( $font, 16 ); $content-> fillcolor( '#ffffff' ); $content-> translate( 62, 565 ); $content-> text( 'Print text in rect' ); $pdf-> saveas( 'test.pdf' );