glib/CMakeLists.txt |6
glib/demo/CMakeLists.txt|1
glib/demo/main.c|4
glib/demo/signature.c | 437 ++
glib/demo/signature.h | 31 +
glib/poppler-document.cc| 98 +++
glib/poppler-document.h |5
glib/poppler-form-field.cc | 1088
glib/poppler-form-field.h | 114 +++
glib/poppler.h |5
glib/reference/poppler-sections.txt | 51 +
glib/reference/poppler.types|2
12 files changed, 1840 insertions(+), 2 deletions(-)
New commits:
commit bdd922b7caaa965828e0e45a6cde0b1585c9740e
Author: Jan-Michael Brummer
Date: Wed Oct 5 08:20:13 2022 +0200
Signatures: Add signing API to glib part
Rectangle corrections by Marek Kasik
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index 52e8687a..4e17440c 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -99,6 +99,10 @@ target_link_libraries(poppler-glib poppler PkgConfig::GLIB2
${CAIRO_LIBRARIES} F
target_include_directories(poppler-glib SYSTEM PRIVATE ${CAIRO_INCLUDE_DIRS})
install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION
${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+if (ENABLE_NSS3)
+target_include_directories(poppler-glib SYSTEM PRIVATE
${NSS3_INCLUDE_DIRS})
+endif()
+
install(FILES
${poppler_glib_public_headers}
${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.h
@@ -150,3 +154,5 @@ endif ()
if(ENABLE_GTK_DOC)
add_subdirectory(reference)
endif()
+
+check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
\ No newline at end of file
diff --git a/glib/demo/CMakeLists.txt b/glib/demo/CMakeLists.txt
index 4c1ae9a5..1520d840 100644
--- a/glib/demo/CMakeLists.txt
+++ b/glib/demo/CMakeLists.txt
@@ -18,6 +18,7 @@ set(poppler_glib_demo_SRCS
layers.c
selections.c
taggedstruct.c
+ signature.c
)
poppler_add_test(poppler-glib-demo BUILD_GTK_TESTS ${poppler_glib_demo_SRCS})
diff --git a/glib/demo/main.c b/glib/demo/main.c
index e7fdea13..9b95b3ed 100644
--- a/glib/demo/main.c
+++ b/glib/demo/main.c
@@ -38,6 +38,7 @@
#include "find.h"
#include "print.h"
#include "selections.h"
+#include "signature.h"
enum
{
@@ -69,7 +70,8 @@ static const PopplerGlibDemo demo_list[] = { { "Info",
pgd_info_create_widget },
{ "Text", pgd_text_create_widget
},
{ "Tagged Structure",
pgd_taggedstruct_create_widget },
{ "Find", pgd_find_create_widget
},
- { "Print",
pgd_print_create_widget } };
+ { "Print",
pgd_print_create_widget },
+ { "Signature",
pgd_signature_create_widget } };
static void pgd_demo_changed(GtkTreeSelection *selection, GtkNotebook
*notebook)
{
diff --git a/glib/demo/signature.c b/glib/demo/signature.c
new file mode 100644
index ..15c68c5a
--- /dev/null
+++ b/glib/demo/signature.c
@@ -0,0 +1,437 @@
+/*
+ * Copyright (C) 2022-2023 Jan-Michael Brummer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+#include
+#include
+
+#include "signature.h"
+#include "utils.h"
+
+typedef struct
+{
+PopplerDocument *doc;
+PopplerPage *page;
+GtkWidget *darea;
+cairo_surface_t *surface;
+gint num_page;
+gint redraw_idle;
+GdkPoint start;
+GdkPoint stop;
+gboolean started;
+GdkCursorType cursor;
+GtkWidget *main_box;
+gdouble scale;
+} PgdSignatureDemo;
+
+/* Render area */
+static cairo_surface_t *pgd_signature_render_page(PgdSignatureDemo *demo)
+{
+cairo_t *cr;
+PopplerPage *page;
+gdouble width, height;
+cairo_surface_t *surface = NULL;
+
+page = poppler_document_get_page(demo->doc, demo->num_page);
+if (!page) {
+return NULL;
+}
+
+poppler_page_get_size(page, , );
+
+width *= demo->scale;
+height *= demo->scale;
+gtk_widget_set_size_request(demo->darea, width, height);
+
+surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height);
+cr = cairo_create(surface);
+
+if