Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
use Poppler;
my $path = 'file:///path/to/some.pdf';
my $o = Poppler::Document->new_from_file($path);
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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.