
Poppler - perl binding of poppler library.

use Poppler;
my $path = 'file:///path/to/some.pdf';
my $o = Poppler::Document->new_from_file($path);
# or if you want to open the pdf in perl, or use some othe source:
# open (PDF, "<FILE.PDF");
# read (PDF, my $data, -s "FILE.PDF");
# close (PDF);
# my $o = Poppler::Document->new_from_data($data, length($data));
my $page = $o->get_page( 0 );
my $dimension = $page->get_size;
warn $dimension->get_width;
warn $dimension->get_height;
# render to cairo
use Cairo;
my $surface = Cairo::ImageSurface->create ('argb32', 100, 100);
my $cr = Cairo::Context->create ($surface);
$page->render_to_cairo( $cr );
$cr->show_page;
$surface->write_to_png ('output.png');
__END__





github repository:
http://github.com/c9s/perl-poppler/tree/master
poppler:
http://poppler.freedesktop.org/

Cornelius , cornelius.howl _at_ gmail.com

Copyright (C) 2009 by c9s (Corenlius)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.