Bug#595900: libpdf-api2-perl: Using TTF creates corrupt PDF

Jeffrey Ratcliffe jeffrey.ratcliffe at gmail.com
Tue Sep 7 05:34:37 UTC 2010


Package: libpdf-api2-perl
Version: 0.73-1
Severity: normal

Attached are two test scripts, one using a core font one using TTF.

The core example runs without errors and the text in the resulting PDF can be extracted by pdftotext.

The TTF example produces multiple errors on running and evince prints errors on opening the PDF, although it displays the text. pdftotext fails to extract the text.


-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-updates
  APT policy: (500, 'lucid-updates'), (500, 'lucid-security'), (500, 'lucid-backports'), (500, 'lucid')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-24-generic (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libpdf-api2-perl depends on:
ii  perl [libcompress-zlib-perl]  5.10.1-13  Larry Wall's Practical Extraction 
ii  ttf-dejavu                    2.30-2     Metapackage to pull in ttf-dejavu-

libpdf-api2-perl recommends no packages.

libpdf-api2-perl suggests no packages.

-- no debconf information
-------------- next part --------------
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 01core.t'
# make test TEST_VERBOSE=1 gives you more info

use Test::More tests => 2;
use strict;
BEGIN { use_ok('PDF::API2') };

my $pdf = PDF::API2-> new(-file => 'test.pdf');
my $page = $pdf->page;
my $font = $pdf->corefont('Times-Roman');
my $text = $page->text;
my $size = 12;
$text->font( $font, $size );
$text->translate( 100, 500 );
$text->text( "My text" );
$pdf->save;
$pdf->end;

my $output = `pdftotext test.pdf -`;
print "pdftotext output: \"$output\"";

ok($output =~ /My text/, 'text can be found by pdftotext');

1;
-------------- next part --------------
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 02ttf.t'
# make test TEST_VERBOSE=1 gives you more info

use Test::More tests => 2;
use strict;
BEGIN { use_ok('PDF::API2') };

my $pdf = PDF::API2-> new(-file => 'test.pdf');
my $page = $pdf->page;
my $font = $pdf->ttfont( 'DejaVuSans.ttf' );
my $text = $page->text;
my $size = 12;
$text->font( $font, $size );
$text->translate( 100, 500 );
$text->text( "My text" );
$pdf->save;
$pdf->end;

my $output = `pdftotext test.pdf -`;
print "pdftotext output: \"$output\"";

ok($output =~ /My text/, 'text can be found by pdftotext');

1;


More information about the pkg-perl-maintainers mailing list