I am trying to write a unicode string to a PDF::API2 object, but I does not work, I get unicode characters messed up
our $pageWidth = 1.25*595;
our $pageHeight = 1.25*842;
my $titleSize = 16;
my $pdf = PDF::API2->new();
$pdf->mediabox((0, 0, $pageWidth, $pageHeight));
my $font = $pdf->corefont('Times', -encode => 'utf-8');
my $page = $pdf->page();
my $text = $page->gfx();
$text->font($font, $titleSize);
my $title = '(Nėra pavadinimo šiam puslapiui)';
my $titleWidth = $text->advancewidth($title);
$text->translate(($pageWidth - $titleWidth) / 2, $pageHeight - $titleSize * 2);
$text->text($title);
my $pdfString = $pdf->stringify();
I get (N ra pavadinimo iam puslapiui)
. What I am doing wrong
通过使用以下来源解决了这个问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.