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



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?

Jeremy


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