Thread PDF::API2 Fonts einbetten (4 answers)
Opened by Rolf_PlusW at 2014-04-30 17:46

GwenDragon
 2014-04-30 18:39
#175147 #175147
User since
2005-01-17
14748 Artikel
Admin1
[Homepage]
user image
Geht doch:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;

use PDF::API2;

my $pdf  = PDF::API2->new(-file => "test.pdf");

my $page = $pdf->page;                               
my $txt = $page->text;                               

my $FranklinGothic = $pdf->ttfont('framd.ttf'); # Franklin Gothic Medium
my $Calibri = $pdf->ttfont('calibri.ttf');      # Calibri

my $y = 740;
my $x = 20;

# and some german uglies: äöü
$txt->font($FranklinGothic, 32);         
$txt->translate($x,$y);                 
$txt->text("Franklin Gothic Medium, 32: ÄÖÜß"); 
$y -= 60;

$txt->font($Calibri, 32);
$txt->translate($x,$y); 
$txt->text("Calibri, 32:  ÄÖÜß"); 
$y -= 60;

$pdf->finishobjects($page,$txt);
$pdf->saveas;
$pdf->end();

Anhänge
application/pdf
test.pdf

View full thread PDF::API2 Fonts einbetten