How to generate "Embeded subset" font using CPAN module PDF::API2
Does anyone know how to generate an "Embeded subset" font using PDF::API2? I can't find any in its documentation and all it tries to do seem to create either just "Embeded" or not embeded font:
my $pdf = PDF::API2->open('blank.pdf');
my $page = $pdf->openpage(1);
my $txt = $page->text;
my $font = $pdf->ttfont('verdana.ttf');
$txt->textlabel( 170, 170, $font, 20, 'text Embeded开发者_高级运维 TTF font');
Another module Text::PDF::TTFont which inherits from Text::PDF does it correctly.
thanks!
I can create an embedded subset
#!/usr/bin/perl
use strict;
use warnings;
use lib 'PDF-API2-0.73/lib/';
use PDF::API2;
my $text = "A sample text using Noto TTF";
my $pdf = PDF::API2->new();
my $page = $pdf->page;
my $txt = $page->text;
my $font = $pdf->ttfont('C:/temp/fonts/NotoSans-Bold.ttf');
$txt->font($font, 25);
$txt->translate(200, 550);
$txt->fillcolor('black');
$txt->text($text);
$pdf->saveas("Noto-TTF.pdf");
精彩评论