[poppler] 8 commits - glib/poppler-document.cc glib/poppler-document.h glib/poppler.h glib/reference

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 21 10:27:59 UTC 2019


 glib/poppler-document.cc            |  167 +++++++++++++++++++++++++++++++++++-
 glib/poppler-document.h             |   44 +++++++++
 glib/poppler.h                      |    1 
 glib/reference/poppler-sections.txt |    5 +
 glib/reference/poppler.types        |    1 
 5 files changed, 214 insertions(+), 4 deletions(-)

New commits:
commit 7e19574b70edefa8161e57c33025987e58b27c03
Author: Marek Kasik <mkasik at redhat.com>
Date:   Wed Aug 21 11:40:53 2019 +0200

    glib: Documentation fixes for viewer preferences
    
    Clarify documentation about returned values
    of recently added viewer preferences.
    
    https://gitlab.freedesktop.org/poppler/poppler/issues/290

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 7181de7e..6b424aa4 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1659,6 +1659,8 @@ poppler_document_get_print_scaling (PopplerDocument *document)
  * @document: A #PopplerDocument
  *
  * Returns the duplex mode value suggested for printing by author of the document.
+ * Value POPPLER_PRINT_DUPLEX_NONE means that the document does not specify this
+ * preference.
  *
  * Returns: a #PopplerPrintDuplex that should be used when document is printed
  *
@@ -1703,6 +1705,9 @@ poppler_document_get_print_duplex (PopplerDocument *document)
  * @document: A #PopplerDocument
  *
  * Returns the suggested number of copies to be printed.
+ * This preference should be applied only if returned value
+ * is greater than 1 since value 1 usually means that
+ * the document does not specify it.
  *
  * Returns: Number of copies
  *
@@ -1735,6 +1740,8 @@ poppler_document_get_print_n_copies (PopplerDocument *document)
  *
  * Returns the suggested page ranges to print in the form of array
  * of #PopplerPageRanges and number of ranges.
+ * NULL pointer means that the document does not specify page ranges
+ * for printing.
  *
  * Returns: (array length=n_ranges) (transfer full): an array
  *          of #PopplerPageRanges or NULL. Free the array when
commit a89b52e9eefa65a099f59e84080c9762a1d9d9a5
Author: Marek Kasik <mkasik at redhat.com>
Date:   Tue Aug 20 21:13:38 2019 +0200

    glib: Return nullptr if n_ranges is nullptr
    
    Return nullptr if we don't have correct pointer for storing
    number of ranges in poppler_document_get_print_page_ranges().
    
    https://gitlab.freedesktop.org/poppler/poppler/issues/290

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index c0c3fc09..7181de7e 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1751,8 +1751,9 @@ poppler_document_get_print_page_ranges (PopplerDocument *document,
   std::vector<std::pair<int, int>> ranges;
   PopplerPageRange *result = nullptr;
 
+  g_return_val_if_fail (n_ranges != nullptr, nullptr);
   *n_ranges = 0;
-  g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL);
+  g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), nullptr);
 
   catalog = document->doc->getCatalog ();
   if (catalog && catalog->isOk ()) {
commit 5a61eb75ca807f050b5f436a32de768f63e6177e
Author: Marek Kasik <mkasik at redhat.com>
Date:   Fri Aug 16 14:25:10 2019 +0200

    glib: Use C struct for PopplerPageRange
    
    Boxed type is not needed so use just common C struct.
    Use G_GNUC_MALLOC attribute on
    poppler_document_get_print_page_ranges().
    
    https://gitlab.freedesktop.org/poppler/poppler/issues/290

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index acd8157a..c0c3fc09 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1662,7 +1662,7 @@ poppler_document_get_print_scaling (PopplerDocument *document)
  *
  * Returns: a #PopplerPrintDuplex that should be used when document is printed
  *
- * Since: 0.78
+ * Since: 0.80
  **/
 PopplerPrintDuplex
 poppler_document_get_print_duplex (PopplerDocument *document)
@@ -1706,7 +1706,7 @@ poppler_document_get_print_duplex (PopplerDocument *document)
  *
  * Returns: Number of copies
  *
- * Since: 0.78
+ * Since: 0.80
  **/
 gint
 poppler_document_get_print_n_copies (PopplerDocument *document)
@@ -1728,53 +1728,6 @@ poppler_document_get_print_n_copies (PopplerDocument *document)
   return retval;
 }
 
-/* PopplerPageRange */
-
-POPPLER_DEFINE_BOXED_TYPE (PopplerPageRange, poppler_page_range,
-			   poppler_page_range_copy,
-			   poppler_page_range_free)
-
-/**
- * poppler_page_range_new:
- *
- * Creates a new #PopplerPageRange
- *
- * Returns: a new #PopplerPageRange, use poppler_page_range_free() to free it
- */
-PopplerPageRange *
-poppler_page_range_new (void)
-{
-  return g_slice_new0 (PopplerPageRange);
-}
-
-/**
- * poppler_page_range_copy:
- * @range: a #PopplerPageRange to copy
- *
- * Creates a copy of @range
- *
- * Returns: a new allocated copy of @range
- */
-PopplerPageRange *
-poppler_page_range_copy (PopplerPageRange *range)
-{
-  g_return_val_if_fail (range != nullptr, NULL);
-
-  return g_slice_dup (PopplerPageRange, range);
-}
-
-/**
- * poppler_page_range_free:
- * @range: a #PopplerPageRange
- *
- * Frees the given #PopplerPageRange
- */
-void
-poppler_page_range_free (PopplerPageRange *range)
-{
-  g_slice_free (PopplerPageRange, range);
-}
-
 /**
  * poppler_document_get_print_page_ranges:
  * @document: A #PopplerDocument
@@ -1787,7 +1740,7 @@ poppler_page_range_free (PopplerPageRange *range)
  *          of #PopplerPageRanges or NULL. Free the array when
  *          it is no longer needed.
  *
- * Since: 0.78
+ * Since: 0.80
  **/
 PopplerPageRange *
 poppler_document_get_print_page_ranges (PopplerDocument *document,
@@ -2342,7 +2295,7 @@ poppler_document_class_init (PopplerDocumentClass *klass)
   /**
    * PopplerDocument:print-duplex:
    *
-   * Since: 0.78
+   * Since: 0.80
    */
   g_object_class_install_property (G_OBJECT_CLASS (klass),
 				   PROP_PRINT_DUPLEX,
@@ -2358,7 +2311,7 @@ poppler_document_class_init (PopplerDocumentClass *klass)
    *
    * Suggested number of copies to be printed for this document
    *
-   * Since: 0.78
+   * Since: 0.80
    */
   g_object_class_install_property (G_OBJECT_CLASS (klass),
 				   PROP_PRINT_N_COPIES,
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index 499991cd..9d8b7053 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -161,7 +161,7 @@ typedef enum
  *
  * Duplex viewer preference
  *
- * Since: 0.78
+ * Since: 0.80
  */
 typedef enum
 {
@@ -400,7 +400,7 @@ POPPLER_PUBLIC
 gint               poppler_document_get_print_n_copies     (PopplerDocument *document);
 POPPLER_PUBLIC
 PopplerPageRange  *poppler_document_get_print_page_ranges  (PopplerDocument *document,
-                                                            int             *n_ranges);
+                                                            int             *n_ranges) G_GNUC_MALLOC;
 
 /* Attachments */
 POPPLER_PUBLIC
@@ -531,25 +531,14 @@ void           poppler_ps_file_free           (PopplerPSFile   *ps_file);
  *
  * A #PopplerPageRange is used to specify a range of pages.
  *
- * Since: 0.78
+ * Since: 0.80
  */
-#define POPPLER_TYPE_PAGE_RANGE               (poppler_page_range_get_type ())
 struct _PopplerPageRange
 {
   gint start_page;
   gint end_page;
 };
 
-POPPLER_PUBLIC
-GType             poppler_page_range_get_type (void) G_GNUC_CONST;
-POPPLER_PUBLIC
-PopplerPageRange *poppler_page_range_new      ();
-POPPLER_PUBLIC
-PopplerPageRange *poppler_page_range_copy     (PopplerPageRange *range);
-POPPLER_PUBLIC
-void              poppler_page_range_free     (PopplerPageRange *range);
-
-
 G_END_DECLS
 
 #endif /* __POPPLER_DOCUMENT_H__ */
commit 18afdb2eef77b39df78bdbf6c9b03f861779e433
Author: Marek Kasik <mkasik at redhat.com>
Date:   Wed Jun 12 19:01:29 2019 +0200

    glib: Make PrintPageRange preference available in API
    
    Add poppler_document_get_print_page_ranges() so that applications which
    use poppler's glib frontend can access this preference.
    
    https://gitlab.freedesktop.org/poppler/poppler/issues/290

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 5c9e6a22..acd8157a 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1776,6 +1776,50 @@ poppler_page_range_free (PopplerPageRange *range)
 }
 
 /**
+ * poppler_document_get_print_page_ranges:
+ * @document: A #PopplerDocument
+ * @n_ranges: (out): return location for number of ranges
+ *
+ * Returns the suggested page ranges to print in the form of array
+ * of #PopplerPageRanges and number of ranges.
+ *
+ * Returns: (array length=n_ranges) (transfer full): an array
+ *          of #PopplerPageRanges or NULL. Free the array when
+ *          it is no longer needed.
+ *
+ * Since: 0.78
+ **/
+PopplerPageRange *
+poppler_document_get_print_page_ranges (PopplerDocument *document,
+                                        int             *n_ranges)
+{
+  Catalog *catalog;
+  ViewerPreferences *preferences;
+  std::vector<std::pair<int, int>> ranges;
+  PopplerPageRange *result = nullptr;
+
+  *n_ranges = 0;
+  g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL);
+
+  catalog = document->doc->getCatalog ();
+  if (catalog && catalog->isOk ()) {
+    preferences = catalog->getViewerPreferences ();
+    if (preferences) {
+      ranges = preferences->getPrintPageRange ();
+
+      *n_ranges = ranges.size ();
+      result = g_new (PopplerPageRange, ranges.size ());
+      for (guint i = 0; i < ranges.size (); ++i) {
+        result[i].start_page = ranges[i].first;
+        result[i].end_page = ranges[i].second;
+      }
+    }
+  }
+
+  return result;
+}
+
+/**
  * poppler_document_get_permissions:
  * @document: A #PopplerDocument
  *
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index 98ceb75b..499991cd 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -398,6 +398,9 @@ POPPLER_PUBLIC
 PopplerPrintDuplex poppler_document_get_print_duplex       (PopplerDocument *document);
 POPPLER_PUBLIC
 gint               poppler_document_get_print_n_copies     (PopplerDocument *document);
+POPPLER_PUBLIC
+PopplerPageRange  *poppler_document_get_print_page_ranges  (PopplerDocument *document,
+                                                            int             *n_ranges);
 
 /* Attachments */
 POPPLER_PUBLIC
diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt
index aff742dd..d94abf22 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -177,6 +177,7 @@ poppler_document_get_pdf_version_string
 poppler_document_get_permissions
 poppler_document_get_print_duplex
 poppler_document_get_print_n_copies
+poppler_document_get_print_page_ranges
 poppler_document_get_print_scaling
 poppler_document_get_producer
 poppler_document_get_subject
commit 40ec62ce12b18f13d84d14a102b8b7c8abafedab
Author: Marek Kasik <mkasik at redhat.com>
Date:   Tue Jun 4 13:08:26 2019 +0200

    glib: Add PopplerPageRange type
    
    This type will be used for getting of suggested page ranges from
    opened document if it contains PrintPageRange viewer preference.
    
    https://gitlab.freedesktop.org/poppler/poppler/issues/290

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index e8742abc..5c9e6a22 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1728,6 +1728,53 @@ poppler_document_get_print_n_copies (PopplerDocument *document)
   return retval;
 }
 
+/* PopplerPageRange */
+
+POPPLER_DEFINE_BOXED_TYPE (PopplerPageRange, poppler_page_range,
+			   poppler_page_range_copy,
+			   poppler_page_range_free)
+
+/**
+ * poppler_page_range_new:
+ *
+ * Creates a new #PopplerPageRange
+ *
+ * Returns: a new #PopplerPageRange, use poppler_page_range_free() to free it
+ */
+PopplerPageRange *
+poppler_page_range_new (void)
+{
+  return g_slice_new0 (PopplerPageRange);
+}
+
+/**
+ * poppler_page_range_copy:
+ * @range: a #PopplerPageRange to copy
+ *
+ * Creates a copy of @range
+ *
+ * Returns: a new allocated copy of @range
+ */
+PopplerPageRange *
+poppler_page_range_copy (PopplerPageRange *range)
+{
+  g_return_val_if_fail (range != nullptr, NULL);
+
+  return g_slice_dup (PopplerPageRange, range);
+}
+
+/**
+ * poppler_page_range_free:
+ * @range: a #PopplerPageRange
+ *
+ * Frees the given #PopplerPageRange
+ */
+void
+poppler_page_range_free (PopplerPageRange *range)
+{
+  g_slice_free (PopplerPageRange, range);
+}
+
 /**
  * poppler_document_get_permissions:
  * @document: A #PopplerDocument
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index a640b391..98ceb75b 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -521,6 +521,30 @@ void           poppler_ps_file_set_duplex     (PopplerPSFile   *ps_file,
 POPPLER_PUBLIC
 void           poppler_ps_file_free           (PopplerPSFile   *ps_file);
 
+/**
+ * PopplerPageRange:
+ * @start_page: first page in the range of pages
+ * @end_page:   last page in the range of pages
+ *
+ * A #PopplerPageRange is used to specify a range of pages.
+ *
+ * Since: 0.78
+ */
+#define POPPLER_TYPE_PAGE_RANGE               (poppler_page_range_get_type ())
+struct _PopplerPageRange
+{
+  gint start_page;
+  gint end_page;
+};
+
+POPPLER_PUBLIC
+GType             poppler_page_range_get_type (void) G_GNUC_CONST;
+POPPLER_PUBLIC
+PopplerPageRange *poppler_page_range_new      ();
+POPPLER_PUBLIC
+PopplerPageRange *poppler_page_range_copy     (PopplerPageRange *range);
+POPPLER_PUBLIC
+void              poppler_page_range_free     (PopplerPageRange *range);
 
 
 G_END_DECLS
diff --git a/glib/poppler.h b/glib/poppler.h
index 91b0b4f9..5d0f16d0 100644
--- a/glib/poppler.h
+++ b/glib/poppler.h
@@ -211,6 +211,7 @@ typedef struct _PopplerQuadrilateral       PopplerQuadrilateral;
 typedef struct _PopplerStructureElement    PopplerStructureElement;
 typedef struct _PopplerStructureElementIter PopplerStructureElementIter;
 typedef struct _PopplerTextSpan            PopplerTextSpan;
+typedef struct _PopplerPageRange           PopplerPageRange;
 
 /**
  * PopplerBackend:
commit a3394adb31e7f6e91bef6f52cfdddb132dc5e32d
Author: Marek Kasik <mkasik at redhat.com>
Date:   Thu Feb 21 16:24:46 2019 +0100

    glib: Make NumCopies preference available in API
    
    Add poppler_document_get_print_n_copies() so that applications which
    use poppler's glib frontend can access this preference.
    
    https://gitlab.freedesktop.org/poppler/poppler/issues/290

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 3dbdec01..e8742abc 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -82,7 +82,8 @@ enum {
 	PROP_PERMISSIONS,
 	PROP_METADATA,
 	PROP_PRINT_SCALING,
-	PROP_PRINT_DUPLEX
+	PROP_PRINT_DUPLEX,
+	PROP_PRINT_N_COPIES
 };
 
 static void poppler_document_layers_free (PopplerDocument *document);
@@ -1698,6 +1699,36 @@ poppler_document_get_print_duplex (PopplerDocument *document)
 }
 
 /**
+ * poppler_document_get_print_n_copies:
+ * @document: A #PopplerDocument
+ *
+ * Returns the suggested number of copies to be printed.
+ *
+ * Returns: Number of copies
+ *
+ * Since: 0.78
+ **/
+gint
+poppler_document_get_print_n_copies (PopplerDocument *document)
+{
+  Catalog *catalog;
+  ViewerPreferences *preferences;
+  gint retval = 1;
+
+  g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), 1);
+
+  catalog = document->doc->getCatalog ();
+  if (catalog && catalog->isOk ()) {
+    preferences = catalog->getViewerPreferences();
+    if (preferences) {
+      retval = preferences->getNumCopies();
+    }
+  }
+
+  return retval;
+}
+
+/**
  * poppler_document_get_permissions:
  * @document: A #PopplerDocument
  *
@@ -1933,6 +1964,9 @@ poppler_document_get_property (GObject    *object,
     case PROP_PRINT_DUPLEX:
       g_value_set_enum (value, poppler_document_get_print_duplex (document));
       break;
+    case PROP_PRINT_N_COPIES:
+      g_value_set_int (value, poppler_document_get_print_n_copies (document));
+      break;
     case PROP_PERMISSIONS:
       g_value_set_flags (value, poppler_document_get_permissions (document));
       break;
@@ -2229,6 +2263,21 @@ poppler_document_class_init (PopplerDocumentClass *klass)
 						      (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
 
   /**
+   * PopplerDocument:print-n-copies:
+   *
+   * Suggested number of copies to be printed for this document
+   *
+   * Since: 0.78
+   */
+  g_object_class_install_property (G_OBJECT_CLASS (klass),
+				   PROP_PRINT_N_COPIES,
+				   g_param_spec_int ("print-n-copies",
+						     "Number of Copies to Print",
+						     "Number of Copies Viewer Preference",
+						     1, G_MAXINT, 1,
+						     (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+  /**
    * PopplerDocument:permissions:
    *
    * Flags specifying which operations are permitted when the document is opened
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index fea3b667..a640b391 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -396,6 +396,8 @@ POPPLER_PUBLIC
 PopplerPrintScaling poppler_document_get_print_scaling     (PopplerDocument *document);
 POPPLER_PUBLIC
 PopplerPrintDuplex poppler_document_get_print_duplex       (PopplerDocument *document);
+POPPLER_PUBLIC
+gint               poppler_document_get_print_n_copies     (PopplerDocument *document);
 
 /* Attachments */
 POPPLER_PUBLIC
diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt
index 1d4ce497..aff742dd 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -176,6 +176,7 @@ poppler_document_get_pdf_version
 poppler_document_get_pdf_version_string
 poppler_document_get_permissions
 poppler_document_get_print_duplex
+poppler_document_get_print_n_copies
 poppler_document_get_print_scaling
 poppler_document_get_producer
 poppler_document_get_subject
commit 038340faee2892b558a255a3578966df3705f69e
Author: Marek Kasik <mkasik at redhat.com>
Date:   Mon Jun 3 15:03:02 2019 +0200

    glib: Make Duplex preference available in API
    
    Add poppler_document_get_print_duplex() function and
    PopplerPrintDuplex enum so that applications which
    use poppler's glib frontend can access this preference.
    
    https://gitlab.freedesktop.org/poppler/poppler/issues/290

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 291c453c..3dbdec01 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -2,7 +2,7 @@
  * Copyright (C) 2005, Red Hat, Inc.
  *
  * Copyright (C) 2016 Jakub Alba <jakubalba at gmail.com>
- * Copyright (C) 2018 Marek Kasik <mkasik at redhat.com>
+ * Copyright (C) 2018-2019 Marek Kasik <mkasik at redhat.com>
  * Copyright (C) 2019 Masamichi Hosoda <trueroad at trueroad.jp>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -81,7 +81,8 @@ enum {
 	PROP_VIEWER_PREFERENCES,
 	PROP_PERMISSIONS,
 	PROP_METADATA,
-	PROP_PRINT_SCALING
+	PROP_PRINT_SCALING,
+	PROP_PRINT_DUPLEX
 };
 
 static void poppler_document_layers_free (PopplerDocument *document);
@@ -1653,6 +1654,50 @@ poppler_document_get_print_scaling (PopplerDocument *document)
 }
 
 /**
+ * poppler_document_get_print_duplex:
+ * @document: A #PopplerDocument
+ *
+ * Returns the duplex mode value suggested for printing by author of the document.
+ *
+ * Returns: a #PopplerPrintDuplex that should be used when document is printed
+ *
+ * Since: 0.78
+ **/
+PopplerPrintDuplex
+poppler_document_get_print_duplex (PopplerDocument *document)
+{
+  Catalog *catalog;
+  ViewerPreferences *preferences;
+  PopplerPrintDuplex duplex = POPPLER_PRINT_DUPLEX_NONE;
+
+  g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), POPPLER_PRINT_DUPLEX_NONE);
+
+  catalog = document->doc->getCatalog ();
+  if (catalog && catalog->isOk ()) {
+    preferences = catalog->getViewerPreferences();
+    if (preferences) {
+      switch (preferences->getDuplex()) {
+        default:
+        case ViewerPreferences::Duplex::duplexNone:
+          duplex = POPPLER_PRINT_DUPLEX_NONE;
+          break;
+        case ViewerPreferences::Duplex::duplexSimplex:
+          duplex = POPPLER_PRINT_DUPLEX_SIMPLEX;
+          break;
+        case ViewerPreferences::Duplex::duplexDuplexFlipShortEdge:
+          duplex = POPPLER_PRINT_DUPLEX_DUPLEX_FLIP_SHORT_EDGE;
+          break;
+        case ViewerPreferences::Duplex::duplexDuplexFlipLongEdge:
+          duplex = POPPLER_PRINT_DUPLEX_DUPLEX_FLIP_LONG_EDGE;
+          break;
+      }
+    }
+  }
+
+  return duplex;
+}
+
+/**
  * poppler_document_get_permissions:
  * @document: A #PopplerDocument
  *
@@ -1885,6 +1930,9 @@ poppler_document_get_property (GObject    *object,
     case PROP_PRINT_SCALING:
       g_value_set_enum (value, poppler_document_get_print_scaling (document));
       break;
+    case PROP_PRINT_DUPLEX:
+      g_value_set_enum (value, poppler_document_get_print_duplex (document));
+      break;
     case PROP_PERMISSIONS:
       g_value_set_flags (value, poppler_document_get_permissions (document));
       break;
@@ -2167,6 +2215,20 @@ poppler_document_class_init (PopplerDocumentClass *klass)
 						      (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
 
   /**
+   * PopplerDocument:print-duplex:
+   *
+   * Since: 0.78
+   */
+  g_object_class_install_property (G_OBJECT_CLASS (klass),
+				   PROP_PRINT_DUPLEX,
+				   g_param_spec_enum ("print-duplex",
+						      "Print Duplex",
+						      "Duplex Viewer Preference",
+						      POPPLER_TYPE_PRINT_DUPLEX,
+						      POPPLER_PRINT_DUPLEX_NONE,
+						      (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
+
+  /**
    * PopplerDocument:permissions:
    *
    * Flags specifying which operations are permitted when the document is opened
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index cb289f2d..fea3b667 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -2,7 +2,7 @@
  * Copyright (C) 2004, Red Hat, Inc.
  *
  * Copyright (C) 2016 Jakub Alba <jakubalba at gmail.com>
- * Copyright (C) 2018 Marek Kasik <mkasik at redhat.com>
+ * Copyright (C) 2018-2019 Marek Kasik <mkasik at redhat.com>
  * Copyright (C) 2019 Masamichi Hosoda <trueroad at trueroad.jp>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -153,6 +153,25 @@ typedef enum
 } PopplerPrintScaling;
 
 /**
+ * PopplerPrintDuplex:
+ * @POPPLER_PRINT_DUPLEX_NONE: No preference on duplex printing
+ * @POPPLER_PRINT_DUPLEX_SIMPLEX: Print single-sided
+ * @POPPLER_PRINT_DUPLEX_DUPLEX_FLIP_SHORT_EDGE: Duplex and flip on the short edge of the sheet
+ * @POPPLER_PRINT_DUPLEX_DUPLEX_FLIP_LONG_EDGE: Duplex and flip on the long edge of the sheet
+ *
+ * Duplex viewer preference
+ *
+ * Since: 0.78
+ */
+typedef enum
+{
+  POPPLER_PRINT_DUPLEX_NONE,
+  POPPLER_PRINT_DUPLEX_SIMPLEX,
+  POPPLER_PRINT_DUPLEX_DUPLEX_FLIP_SHORT_EDGE,
+  POPPLER_PRINT_DUPLEX_DUPLEX_FLIP_LONG_EDGE
+} PopplerPrintDuplex;
+
+/**
  * PopplerPermissions:
  * @POPPLER_PERMISSIONS_OK_TO_PRINT: document can be printer
  * @POPPLER_PERMISSIONS_OK_TO_MODIFY: document contents can be modified
@@ -375,6 +394,8 @@ POPPLER_PUBLIC
 gchar             *poppler_document_get_metadata           (PopplerDocument *document);
 POPPLER_PUBLIC
 PopplerPrintScaling poppler_document_get_print_scaling     (PopplerDocument *document);
+POPPLER_PUBLIC
+PopplerPrintDuplex poppler_document_get_print_duplex       (PopplerDocument *document);
 
 /* Attachments */
 POPPLER_PUBLIC
diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt
index 2da8aea5..1d4ce497 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -175,6 +175,7 @@ poppler_document_get_pdf_subtype_string
 poppler_document_get_pdf_version
 poppler_document_get_pdf_version_string
 poppler_document_get_permissions
+poppler_document_get_print_duplex
 poppler_document_get_print_scaling
 poppler_document_get_producer
 poppler_document_get_subject
@@ -248,6 +249,7 @@ POPPLER_TYPE_PDF_CONFORMANCE
 POPPLER_TYPE_PDF_PART
 POPPLER_TYPE_PDF_SUBTYPE
 POPPLER_TYPE_PERMISSIONS
+POPPLER_TYPE_PRINT_DUPLEX
 POPPLER_TYPE_PRINT_SCALING
 POPPLER_TYPE_PS_FILE
 POPPLER_TYPE_VIEWER_PREFERENCES
@@ -263,6 +265,7 @@ poppler_pdf_conformance_get_type
 poppler_pdf_part_get_type
 poppler_pdf_subtype_get_type
 poppler_permissions_get_type
+poppler_print_duplex_get_type
 poppler_print_scaling_get_type
 poppler_ps_file_get_type
 poppler_viewer_preferences_get_type
diff --git a/glib/reference/poppler.types b/glib/reference/poppler.types
index 2f7a3991..a8712f81 100644
--- a/glib/reference/poppler.types
+++ b/glib/reference/poppler.types
@@ -59,6 +59,7 @@ poppler_pdf_part_get_type
 poppler_pdf_subtype_get_type
 poppler_permissions_get_type
 poppler_point_get_type
+poppler_print_duplex_get_type
 poppler_print_flags_get_type
 poppler_print_scaling_get_type
 poppler_ps_file_get_type
commit fb05cab36ec1c29ea1e2f727bba95db58b692a95
Author: Marek Kasik <mkasik at redhat.com>
Date:   Wed Jan 16 12:47:38 2019 +0100

    glib: Make print scaling getter visible
    
    Prefix poppler_document_get_print_scaling with POPPLER_PUBLIC
    in glib/poppler-document.h.

diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index 32614c55..cb289f2d 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -373,6 +373,7 @@ POPPLER_PUBLIC
 PopplerPDFConformance poppler_document_get_pdf_conformance (PopplerDocument *document);
 POPPLER_PUBLIC
 gchar             *poppler_document_get_metadata           (PopplerDocument *document);
+POPPLER_PUBLIC
 PopplerPrintScaling poppler_document_get_print_scaling     (PopplerDocument *document);
 
 /* Attachments */


More information about the poppler mailing list