Closed tbrowder closed 9 months ago
Completely undocumented at the moment. Both the .print and .say methods can take a PDF::Content::Text::Box object. This takes the same parameters as the .print and .say, except for the output position. The textbox has .underline-position and .underline-thickness accessors that return scaled values.
I need to add documentation. Also a .font-height accessor.
Code snippet below:
use PDF::Lite;
use PDF::Content;
use PDF::Content::Text::Box;
my PDF::Lite $pdf .= new;
my $font-size = 16;
my $height = 20;
my $text = "Hello. Ting, ting-ting.";
my PDF::Content::Font::CoreFont $font .= load-font( :family<helvetica>, :weight<bold> );
my PDF::Content::Text::Box $text-box .= new( :$text, :$font, :$font-size, :$height );
say "width:" ~ $text-box.width;
say "height:" ~ $text-box.height;
say "underline-thickness:" ~ $text-box.underline-thickness;
say "underline-position:" ~ $text-box.underline-position;
my $page = $pdf.add-page;
$page.text: {
.text-position = 10, 20;
.say: $text-box;
.text-position = 10, 50;
.print: $text-box;
}
$pdf.save-as: "test.pdf";
Closing since I can use it now.
They are helpful for fine-tuning special effects. And they should be sized accordingly by :$font-size.