Gtk3::Ex::PdfViewer - Complete PDF viewer widget for GTK3 applications
use Gtk3::Ex::PdfViewer; my $viewer = Gtk3::Ex::PdfViewer->new(); my $window = Gtk3::Window->new(); $window->add( $viewer ); $viewer->show_file( '/home/robert/test.pdf' );
Gtk3::Ex::PdfViewer creates a scrolled window that displays a PDF file. It provides controls for moving forward and backward through the document. Embed the viewer inside of Gtk3::Box to integrate it with your application.
Gtk3::Ex::PdfViewer is object oriented. Each instance creates an entirely independent viewer. Your application can create as many viewer widegets as it needs.
This attribute returns the viewer's Gtk3::Box. Use widget to place the viewer inside of its parent. Gtk3::Ex::PdfViewer creates all of the child widgets and connects the signals to flip through the document.
widget
This method displays the binary representation of a PDF document. You can get a binary representation from a PDF generator or the BLOB field of a database. show_blob takes the PDF data as its only argument.
show_blob
This method displays the PDF document from a file. It takes a path to the PDF file as its only argument.
Blank out the PDF area. This is for when there is no PDF to display. It merely shows an empty, grey box.
page tells you the currently displayed page number. Page numbers start at 1. A page number of zero means that the viewer is empty (no PDF document).
page
If you pass in a page number, the viewer jumps to that page in the document.
pages tells you the total number of pages in the PDF document. It is set by show_file or show_blob.
pages
show_file
This attribute is the Poppler object for manipulating the PDF document. It is set by show_file or show_blob.
Gtk3::Ex::PdfViewer assigns default signal handlers to the widgets that it creates. These are not methods of the object. They are GTK callback functions. You can connect them to your own widgets - like menu options - to control the PDF viewer.
This method responds to the draw event of the "drawing_area" widget. It displays a single page from the PDF in the scrolling area.
This routine responds to a click of the right arrow. It moves forward one page in the document.
This routine responds to a click of the left arrow. It moves back one page in the document.
These attributes reference the individual widgets of the viewer. You can use these to customize their behavior.
This Gtk3::DrawingArea displays the image of the PDF. By default, it calls "on_drawingarea_draw" to handle the draw event. "on_drawingarea_draw" does the actual document display.
This button moves to the next page in the document. It calls "on_button_next_click".
This label displays the current page. It sits between the next and previous buttons. The text is changed whenever the viewer shows a new page.
This button moves to the prvious page in the document. It calls "on_button_previous_click".
The Gtk3::PdfViewer object uses these methods internally. You should never use them in your own code. They will change without notice. I documented them for the maintainers.
This boolean flag displays status messages so that you can trace down problems. A true value displays the messages. false hides them. The default value is false.
This is a very simple viewer. It does handle zoom, printing, or any other amentities.
The widget displays PDFs one page at a time. You must use the buttons to change pages. The scroll bars do not cross pages.
Robert Wohlfarth (rbwohlfarth@gmail.com)
https://developer.gnome.org/gtk3/stable/
https://developer.gnome.org/poppler/unstable/
Copyright (c) 2013 Robert Wohlfarth
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This software comes with NO WARRANTY of any kind.
2 POD Errors
The following errors were encountered while parsing the POD:
alternative text 'https://developer.gnome.org/gtk3/stable/' contains non-escaped | or /
alternative text 'https://developer.gnome.org/poppler/unstable/' contains non-escaped | or /
To install Gtk3::Ex::PdfViewer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk3::Ex::PdfViewer
CPAN shell
perl -MCPAN -e shell install Gtk3::Ex::PdfViewer
For more information on module installation, please visit the detailed CPAN module installation guide.