PDF::AP...:CJKFont(3)
π PDF::API2::Resource::CIDFont::CJKFont β the man page, but make it make sense π
okay bestie, welcome to the PDF::API2::Resource::CIDFont::CJKFont(3) page β¨ (yes the header shortens it to PDF::AP...:CJKFont(3), she's shy, we don't talk about it). Sit down, grab a strawberry π, because this one is mostly a β¨ gentle intervention β¨.
πΈ NAME πΈ
PDF::API2::Resource::CIDFont::CJKFont β the deprecated base class for CJK fonts π«Ά
π¦ DESCRIPTION π¦
ngl bestie, this is not the CJK font support you are looking for π. This class dates alllll the way back to the days when Unicode was young and poorly supported, and the PDFs you make with it are not portable. it's giving legacy. it's giving "please don't".
Instead?? use a regular TrueType or OpenType font that includes Unicode support and just make your PDF normally, like the main character you are π:
use PDF::API2;
use utf8;
my $pdf = PDF::API2->new();
my $font = $pdf->font('/path/to/font.ttf');
my $page = $pdf->page();
my $content = $page->text();
$content->font($font, 24);
# Chinese
$content->translate(72, 72 * 9);
$content->text('δ½ ε₯½');
# Japanese
$content->distance(0, -72);
$content->text('γγγ«γ‘γ―');
# Korean
$content->distance(0, -72);
$content->text('μλ
νμΈμ');
$pdf->save('hello.pdf');
look at her. multilingual. flawless. no deprecated nonsense. slay π
Note: the maintainer is not familiar with CJK languages and deprecated this class based on his current understanding of Unicode and from reading many bug reports π. If you are successfully using the CJK support from this class and think it should not be deprecated, please contact him to discuss β he genuinely wants to hear it, no cap π«Ά.
π DEPRECATED METHODS π
$font = $class->new($pdf, $cjk_font_name, %options)β returns a CJK font object β¨. The requested font will not be embedded in the PDF, so it will only be readable on computers that have the font installed π« (yes, that's the vibe, and yes, that's why portability is a whole thing).
Available fonts:
- Chinese (Traditional)
Ming,Ming-Bold,Ming-Italic, andMing-BoldItalic
- Chinese (Simplified)
Song,Song-Bold,Song-Italic, andSong-BoldItalic
- Korean
MyungJo,MyungJo-Bold,MyungJo-Italic, andMyungJo-BoldItalic
- Japanese (Mincho Serif)
KozMin,KozMin-Bold,KozMin-Italic, andKozMin-BoldItalic
- Japanese (Gothic Sans Serif)
KozGo,KozGo-Bold,KozGo-Italic,KozGo-BoldItalic
If the text isn't UTF-8, include an "-encode" option with the encoding to be used π.
and that's the whole page, bestie π this one came to you from perl v5.42.0, dated 2025-09-01 β thanks for reading, go use a real Unicode font, ily, bye π¦β¨
π¦ 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