This script works for me on your testFile.txt. The line setting arial font caused an error, so I commented it out. Make sure you save the testFile.txt as utf8. Also, I didn't need the decode, just use the $content. Also, the $content line was sort of long, so I only used the last portion to observe the accents.
#!/usr/bin/perl
use warnings;
use strict;
use PDF::Reuse;
use utf8::all;
prFile('test.pdf');
#reading UTF-8 data from file
open FILE, "<testFile.txt" or die "$!\n";;
my $content = "";
while (<FILE>)
{
$content .= $_;
}
print "$content\n";
prText(100, 500, $content );
prEnd();
close FILE;
| [reply] [d/l] |
| [reply] |
Any other idea? :-)I just googled for prTTFont PDF::Reuse to see what bugs were out there, and found this bit of advice which pointed to some code in the docs using TrueType_font . It might be worth a try, to get the font object first, then set it as the font.
my $arial = prTTFont('/path/to/Arial.ttf');
prFontSize(20);
prText(20, 700, 'Some text in Arial');
#
# ... later ...
#
prPage();
prTTFont($arial);
prFontSize(12);
prText(20, 700, 'Some more text in Arial');
#
# to pass a UTF8 string to prText
#
prText(20, 675, "T\x{113}n\x{101} koutou"); # T?n? Koutou
| [reply] [d/l] |