Scroll to navigation

PDF::API2::Resource::CIDFont::CJKFont(3) User Contributed Perl Documentation PDF::API2::Resource::CIDFont::CJKFont(3)


PDF::API2::Resource::CIDFont::CJKFont - Deprecated base class for CJK fonts


This is not the CJK font support you are looking for. It dates back to the days when Unicode was young and poorly supported. PDFs created using this class are not portable.

Instead, use a regular TrueType or OpenType font that includes Unicode support and create your PDF normally:

    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);
    # Japanese
    $content->distance(0, -72);
    # Korean
    $content->distance(0, -72);

Note: The maintainer is not familiar with CJK languages and has 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.


$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.

Available fonts:

Ming, Ming-Bold, Ming-Italic, and Ming-BoldItalic
Song, Song-Bold, Song-Italic, and Song-BoldItalic
MyungJo, MyungJo-Bold, MyungJo-Italic, and MyungJo-BoldItalic
KozMin, KozMin-Bold, KozMin-Italic, and KozMin-BoldItalic
KozGo, KozGo-Bold, KozGo-Italic, KozGo-BoldItalic

If the text isn't UTF-8, include an "-encode" option with the encoding to be used.

2024-06-23 perl v5.40.0