From a4023a5023d7b1b2bab75674643717a035de1a4e Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 23 Nov 2025 21:04:19 +0100 Subject: [PATCH] Render pdf --- flake.nix | 1 + src/meson.build | 1 + src/window.vala | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/flake.nix b/flake.nix index b6edcfd..c351049 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ glib libadwaita libsoup_3 + poppler ]; }; default = self.packages."${system}".allesapp; diff --git a/src/meson.build b/src/meson.build index 06750e8..3056100 100644 --- a/src/meson.build +++ b/src/meson.build @@ -9,6 +9,7 @@ allesapp_deps = [ dependency('gtk4'), dependency('libadwaita-1', version: '>= 1.4'), dependency('libsoup-3.0'), + dependency('poppler-glib'), ] allesapp_sources += gnome.compile_resources('allesapp-resources', diff --git a/src/window.vala b/src/window.vala index 453d8d3..85d677f 100644 --- a/src/window.vala +++ b/src/window.vala @@ -37,6 +37,11 @@ public class Allesapp.Window : Adw.ApplicationWindow { } public void draw_pdf (Gtk.DrawingArea drawing_area, Cairo.Context cr, int width, int height) { + var uri = File.new_for_commandline_arg("test.pdf").get_uri(); + var document = new Poppler.Document.from_file (uri, null); + var page = document.get_page (0); + + page.render (cr); cr.arc( width / 2, height / 2,