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



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?


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