Re: G::O::I based bindings and problem passing char array ref



On Wed, 1 Jun 2016 22:39:45 +0200
Torsten Schoenfeld <kaffeetisch gmx de> wrote:

On 31.05.2016 20:07, Jeremy Volkening wrote:
Since new_from_data is currently not annotated to take an array of
bytes, a normal string should work fine in Perl.  This works for
me:

---
use Glib::Object::Introspection;
BEGIN {
  Glib::Object::Introspection->setup (
    basename => 'Poppler',
    version => '0.18',
    package => 'Poppler');
}

my $f = 'some PDF file';
open my $fh, '<:raw', $f or die "Could not open $f: $!";
my $data; { undef $/; $data = <$fh> };
close $fh;

warn my $d = Poppler::Document->new_from_data ($data, length
$data); ---

Does it not work for you?

No - I get "PDF document is damaged at
/usr/lib/x86_64-linux-gnu/perl5/5.20/Glib/Object/Introspection.pm
line 58."

What version of Poppler do you have?

0.41.0, and G:O:I from Git, but I don't think there were any recent
changes that are relevant.  Does this happen for all PDF files you
try?

Tried installing the latest glib (2.48), gobject-introspection (2.48),
libpoppler (0.44), and Glib::Object::Introspection (from git) - same
errors.

Can anyone else test that the above code does or doesn't work on their system?
If it's just me I guess I won't worry about it too much, although I'd like to
know why.

Jeremy


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]