PDF::AP...CoreFont(3)
β¨ NAME β¨
PDF::API2::Resource::Font::CoreFont β the module that lets you use the 14 standard PDF fonts, bestie. no font files, no downloads, just vibes π
π SYNOPSIS π
okay so here's the whole serve in one go:
my $pdf = PDF::API2->new();
my $font = $pdf->font('Times-Roman');
my $page = $pdf->page();
my $text = $page->text();
$text->font($font, 20);
$text->translate(200, 700);
$text->text('Hello world!');
$pdf->save('/path/to/new.pdf');
like. that's it. you make a pdf, you grab a font, you write 'Hello world!' on a page, you save it. main character behaviour fr fr π
π STANDARD FONTS π
these fourteen fonts are available in every single PDF reader that conforms to the PDF specification. no cap. they're just there, always, waiting for you like a loyal bestie π«Ά
CourierCourier-BoldCourier-BoldObliqueCourier-ObliqueHelveticaHelvetica-BoldHelvetica-BoldObliqueHelvetica-ObliqueSymbolTimes-BoldTimes-BoldItalicTimes-ItalicTimes-RomanZapfDingbats
β οΈ okay important thing, don't skip this: these fonts exceptSymbolandZapfDingbatsonly include glyphs for ASCII and certain Latin characters. that's it. if you need other characters, you will need to embed a font file. no shortcuts, sorry babe π
π¦ METHODS π¦
π« is_standard
my $boolean = PDF::API2::Resource::Font::CoreFont->is_standard($name);
returns true if $name is an exact, case-sensitive match for one of the standard font names up there βοΈ. so yes bestie, casing matters β 'times-roman' is giving lowercase flop energy and it will NOT match 'Times-Roman'. it's giving exact match or nothing π
πΈ names
my @font_names = PDF::API2::Resource::Font::CoreFont->list();
my $array_ref = PDF::API2::Resource::Font::CoreFont->list();
returns an array, or a reference to an array, containing the names of the built-in core (standard) fonts. list context? you get the array. scalar context? you get the ref. choose your fighter, both are valid πβ¨
and that's the whole page, bestie π this lil icon was brought to you by perl v5.42.0, dated 2025-09-01, and it's part of the User Contributed Perl Documentation. slay, go write some fonts π πβ
π¦ where this page comes from
- fedora 43: perl-PDF-API2 2.048-1.fc43 Β· LGPL-2.1-or-later AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND (MIT OR Artistic-1.0-Perl)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms