1

我的helloword代码:

import gi

gi.require_version('Poppler', '0.18')
gi.require_version('Gtk', '3.0')

from gi.repository import Poppler, Gtk

def draw(vp, surface):
    surface.set_source_rgb(0.7, 0.7, 0.7)
    surface.paint()
    size = page.get_size()
  
    surface.set_source_rgb(1, 1, 1)
    surface.rectangle(0,0, *size)
    surface.fill()
    
    
    page.render_for_printing(surface)

document = Poppler.Document.new_from_file("file:///home/eri/invoice-V6605371.pdf", None)
n = document.get_n_pages()
page = document.get_page(0)

window = Gtk.Window(title="View", resizable=False, decorated=False )

sc = Gtk.ScrolledWindow()
window.add(sc)


window.connect("delete-event", Gtk.main_quit)

vp = Gtk.Viewport()
vp.set_app_paintable(True)
vp.connect("draw", draw)
sc.add(vp)

window.maximize()
window.show_all()

Gtk.main()

如何在 Yocto / OpenEmbeded 中为其安装运行时?

/usr/lib/girepository-1.0/在rootfs之后

MACHINE_FEATURES_append = " qemu-usermode "
DISTRO_FEATURES_append = " gobject-introspection-data "
4

0 回答 0