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

2010-09-09 Thread Jeffrey Ratcliffe
clone 595900 -1
retitle -1 Warnings whilst creating PDF with TTF
severity -1 minor
retitle 595900 Text written with TTF not extracted by pdftotext
severity 595900 wishlist
tags 595900 - unreproducible
thanks

I've concluded that the reason pdftotext doesn't extract text written
with TTF by libpdf-api2-perl is that the module does not write the
(optional) /ToUnicode table that pdftotext requires to do this.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2010-09-07 Thread Damyan Ivanov
tags 595900 unreproducible
thanks

-=| Jeffrey Ratcliffe, Tue, Sep 07, 2010 at 07:34:37AM +0200 |=-
 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.

Ack.

 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.

On my system (libpdf-api2-perl 0.73-1, same as yours) there are no 
errors when running and evince opens the pdf just fine. Inspecting the 
file with hexdump shows that in the later case the font is embedded in 
the PDF.

texttopdf still can't extract it, but I am not so sure the problem is 
in PDF::API2. kpdf shows the file fine too (no warnings)

(BTW, the diagnostic output about pdftotext results is better written 
with 'diag', instead of 'print' in order not to interfere with test 
output)


signature.asc
Description: Digital signature


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

2010-09-07 Thread Jeffrey Ratcliffe
retitle 595900 TTF font not found by pdftotext
thanks

On 7 September 2010 12:23, Damyan Ivanov d...@debian.org wrote:
 On my system (libpdf-api2-perl 0.73-1, same as yours) there are no
 errors when running and evince opens the pdf just fine. Inspecting the
 file with hexdump shows that in the later case the font is embedded in
 the PDF.

Your right. Evince opens it fine. I can't reproduce the corruption any
more. However, I still get a huge list of warnings:

$ perl -w t/02ttf.t
1..2
ok 1 - use PDF::API2;
Use of uninitialized value in numeric gt () at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 258.
Use of uninitialized value $delta in addition (+) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 374.
Use of uninitialized value $v in numeric ne (!=) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 374.
Use of uninitialized value $v in numeric eq (==) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 375.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 411.
Use of uninitialized value $current in addition (+) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 426.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 353.
Use of uninitialized value $delta in addition (+) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 374.
Use of uninitialized value $v in numeric ne (!=) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 374.
Use of uninitialized value $v in numeric eq (==) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 375.
Use of uninitialized value in pack at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 411.
Use of uninitialized value $current in addition (+) at
/usr/share/perl5/PDF/API2/Basic/TTF/Cmap.pm line 426.

 (BTW, the diagnostic output about pdftotext results is better written
 with 'diag', instead of 'print' in order not to interfere with test
 output)

Thanks for the tip.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



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

2010-09-06 Thread Jeffrey Ratcliffe
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-dejavu2.30-2 Metapackage to pull in ttf-dejavu-

libpdf-api2-perl recommends no packages.

libpdf-api2-perl suggests no packages.

-- no debconf information
# 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;# 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;