PDF::TextBlock

Easier creation of text blocks when using PDF::API2
Download

PDF::TextBlock Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jay Hannah
  • Publisher web site:
  • http://search.cpan.org/~jhannah/

PDF::TextBlock Tags


PDF::TextBlock Description

Easier creation of text blocks when using PDF::API2 Neither Rick Measham's excellent PDF::API2 tutorial nor PDF::FromHTML are able to cope with wanting some words inside a text block to be bold. The PDF::TextBlock Perl module makes that task trivial.Simply define whatever tags you want PDF::TextBlock to honor inside the fonts hashref, and then you are free to use HTML-like markup in the text attribute and we'll render those fonts for you.We also honor the HTML-like tag < href >. This means that we add annotation to the PDF for you which makes the word(s) you wrap in clickable, and we underline those words.Note this markup syntax is very rudimentary. We do not support HTML. Tags cannot overlap each other. There is no way to escape tags inside text().The tests in t/ generate .pdf files. You might find those examples helpful. Watch out for 20-demo.pdf. It spits.SYNOPSIS use PDF::API2; use PDF::TextBlock; my $pdf = PDF::API2->new( -file = > "40-demo.pdf" ); my $tb = PDF::TextBlock- >new({ pdf = > $pdf, fonts = > { b = > PDF::TextBlock::Font->new({ pdf = > $pdf, font = > $pdf->corefont( 'Helvetica-Bold', -encoding = > 'latin1' ), }), }, }); $tb- >text( $tb- >garbledy_gook . ' < b >This fairly lengthy< /b >, rather verbose sentence < b >is tagged< /b > to appear ' . 'in a < b >different font, specifically the one we tagged b for "bold".< /b > ' . $tb- >garbledy_gook . ' < href="http://www.omnihotels.com" >Click here to visit Omni Hotels.< /href > ' . $tb- >garbledy_gook . "\n\n" . "New paragraph.\n\n" . "Another paragraph." ); $tb- >apply; $pdf- >save; $pdf- >end; Requirements: · Perl


PDF::TextBlock Related Software