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 🫢

  • Courier
  • Courier-Bold
  • Courier-BoldOblique
  • Courier-Oblique
  • Helvetica
  • Helvetica-Bold
  • Helvetica-BoldOblique
  • Helvetica-Oblique
  • Symbol
  • Times-Bold
  • Times-BoldItalic
  • Times-Italic
  • Times-Roman
  • ZapfDingbats
⚠️ okay important thing, don't skip this: these fonts except Symbol and ZapfDingbats only 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