简体   繁体   中英

How to generate “Embeded subset” font using CPAN module PDF::API2

Does anyone know how to generate an "Embeded subset" font using ?生成“嵌入式子集”字体? 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 which inherits from 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");

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM