Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3943146
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:44:51+00:00 2026-05-20T00:44:51+00:00

Platform: Linux, GTK+ Tools: Python, PyGTK and Glade. Problem: I’d like to write a

  • 0

Platform: Linux, GTK+

Tools: Python, PyGTK and Glade.

Problem:

  • I’d like to write a program that is capable of displaying a PDF file.

Question:

  • Which widget(s) and Python module(s) do I need?

Thanks for any suggestions!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:44:51+00:00Added an answer on May 20, 2026 at 12:44 am

    look into the python poppler bindings.

    I render pdf files in a simple dirty way. I copied the method used in the example for the python poppler gtk bindings

    def load_pdf(self):
        self.doc = poppler.document_new_from_file (uri, None)
        # the number of pages in the pdf
        self.n_pgs = self.document.get_n_pgs()
        # the current page of the pdf
        self.curr_pg = 0
        # the current page being displayed
        self.curr_pg_disp = self.document.get_page(self.curr_pg)
        # the scale of the page
        self.scale = 1
        # the document width and height
        self.doc_width, self.doc_height = self.curr_pg_disp.get_size()
    
    
    def render_pdf(self):
        cr = self.pdfda.window.cairo_create()
        cr.set_source_rgb(1, 1, 1)
        if self.scale != 1:
            cr.scale(self.scale, self.scale)
        cr.rectangle(0, 0, self.doc_width, self.doc_height)
        cr.fill()
        self.curr_pg_disp.render(cr)
    
    def on_next_btn_clicked(self, widget, data=None):
        if self.curr_pg < self.n_pgs:
            self.curr_pg = self.curr_pg + 1
            self.curr_pg_disp = self.doc.get_page(self.curr_pg)
            self.render_page()
    
    def on_prev_btn_clicked(self, widget, data=None):
        if self.curr_pg > 0:
            self.curr_pg = self.curr_pg - 1
            self.curr_pg_disp = self.doc.get_page(self.curr_pg)
            self.render_page()
    

    Its not the best or prettiest but it works. I still have to add how to make it scrollable or center in the drawing area and stuff like that but there is a start.

    you could also look into the evince python bindings, I do believe they have a widget you can use for to make pdf rendering easier. I’m on developing on windows so I haven’t used it if there is one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cross platform program that runs on Windows, Linux and Macintosh. My
I really want to write .NET apps that run on any platform (PC, Linux
I am looking to write some C# code for linux/windows/mac/any other platform, and am
Platform: Linux, OSX Compiler: GCC I've got a simple program which is currently confounding
For writing scripts for process automation in Linux platform, which scripting language will be
I need a cross platform solution for clearing the console in both Linux and
What's the current status of Mono 's Platform Invoke implementation on Linux and on
I am working on embedded linux platform with limited system resources . I want
Is anyone aware of a good, general purpose file preview component for linux/Qt/GTK/c/C++ applications?
I'm considering writing a cross-platform desktop app, initially for Mac/Windows, but eventually for Linux

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.