Languages

poppler

[Genie] Simple PDF viewer

5
Your rating: None Average: 5 (1 vote)
[indent=4]
 
/* Build with valac --pkg gtk+-2.0 --pkg poppler-glib yourfile.gs */
 
uses 
    Gtk
    Poppler
 
class PopplerSample : Window
    document : Poppler.Document
    image : Image
    index:int = 0
    init
        title = "Simple PDF Viewer"
        window_position = WindowPosition.CENTER
        destroy += Gtk.main_quit
 
    def PopplerSample (pdf_filename : string)
        try
            this.document = new Poppler.Document.from_file (Filename.to_uri (pdf_filename), "");
        except e:OptionError
            print ("%s", e.message)
        // Create an 

Poppler sample

0
Your rating: None
/* Using Poppler for PDF rendering in Vala sample code */
 
using Gtk;
 
public class PopplerSample : Window {
 
    // To store the document and the current page
    private Poppler.Document document;
    private Image image;
    private int index = 0;
 
    // To create an application object with the name of the file to display
    public PopplerSample (string file_name) {
        try {
            this.document = new Poppler.Document.from_file (Filename.to_uri (file_name), "");
        } catch (Error e) {
            error ("%s", e.message);
        }
 
        // Create 
Syndicate content