如何使用CPAN模块生成"Embeded subset"字体 PDF::API2



有人知道如何使用PDF::API2生成"嵌入子集"字体吗?我在它的文档中找不到任何字体,它所做的一切似乎都是创建"嵌入式"或非嵌入式字体:

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');

另一个模块Text::PDF::TTFont继承自Text::PDF,可以正确执行此操作。

谢谢!

我可以创建一个嵌入式子集

#!/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");

最新更新