[poppler] glib/poppler-document.cc glib/poppler-document.h glib/test-poppler-glib.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sun Jan 27 10:37:04 PST 2008


 glib/poppler-document.cc  |    2 ++
 glib/poppler-document.h   |    3 ++-
 glib/test-poppler-glib.cc |   21 +++++++++++++++++++--
 3 files changed, 23 insertions(+), 3 deletions(-)

New commits:
commit 053369678963206a4afa88a614de1994872c7c5a
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sun Jan 27 19:36:28 2008 +0100

    Add ok_to_fill_form permission flag

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 16536a9..a363b83 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -632,6 +632,8 @@ poppler_document_get_property (GObject    *object,
 	flag |= POPPLER_PERMISSIONS_OK_TO_COPY;
       if (document->doc->okToAddNotes ())
 	flag |= POPPLER_PERMISSIONS_OK_TO_ADD_NOTES;
+      if (document->doc->okToFillForm ())
+        flag |= POPPLER_PERMISSIONS_OK_TO_FILL_FORM;
       g_value_set_flags (value, flag);
       break;
     case PROP_METADATA:
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index 8e4f211..8d76231 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -86,7 +86,8 @@ typedef enum /*< flags >*/
   POPPLER_PERMISSIONS_OK_TO_MODIFY = 1 << 1,
   POPPLER_PERMISSIONS_OK_TO_COPY = 1 << 2,
   POPPLER_PERMISSIONS_OK_TO_ADD_NOTES = 1 << 3,
-  POPPLER_PERMISSIONS_FULL = (POPPLER_PERMISSIONS_OK_TO_PRINT | POPPLER_PERMISSIONS_OK_TO_MODIFY | POPPLER_PERMISSIONS_OK_TO_COPY | POPPLER_PERMISSIONS_OK_TO_ADD_NOTES)
+  POPPLER_PERMISSIONS_OK_TO_FILL_FORM = 1 << 4,
+  POPPLER_PERMISSIONS_FULL = (POPPLER_PERMISSIONS_OK_TO_PRINT | POPPLER_PERMISSIONS_OK_TO_MODIFY | POPPLER_PERMISSIONS_OK_TO_COPY | POPPLER_PERMISSIONS_OK_TO_ADD_NOTES | POPPLER_PERMISSIONS_OK_TO_FILL_FORM)
 
 } PopplerPermissions;
 
diff --git a/glib/test-poppler-glib.cc b/glib/test-poppler-glib.cc
index a3cc38e..108110f 100644
--- a/glib/test-poppler-glib.cc
+++ b/glib/test-poppler-glib.cc
@@ -58,6 +58,7 @@ print_document_info (PopplerDocument *document)
   PopplerPageLayout layout;
   PopplerPageMode mode;
   PopplerViewerPreferences view_prefs;
+  PopplerPermissions permissions;
   PopplerFontInfo *font_info;
   PopplerFontsIter *fonts_iter;
   PopplerIndexIter *index_iter;
@@ -77,6 +78,7 @@ print_document_info (PopplerDocument *document)
 		"page-mode", &mode,
 		"page-layout", &layout,
 		"viewer-preferences", &view_prefs,
+		"permissions", &permissions,
 		NULL);
 
   printf ("\t---------------------------------------------------------\n");
@@ -128,8 +130,23 @@ print_document_info (PopplerDocument *document)
       print_index (index_iter);
       poppler_index_iter_free (index_iter);
     }
-  
 
+  printf ("\t---------------------------------------------------------\n");
+  printf ("\tDocument Permissions\n");
+  printf ("\t---------------------------------------------------------\n");
+
+  printf ("\tOk to Print: %s\n",
+	  permissions & POPPLER_PERMISSIONS_OK_TO_PRINT ? "Yes" : "No");
+  printf ("\tOk to Modify: %s\n",
+	  permissions & POPPLER_PERMISSIONS_OK_TO_MODIFY ? "Yes" : "No");
+  printf ("\tOk to Copy: %s\n",
+	  permissions & POPPLER_PERMISSIONS_OK_TO_COPY ? "Yes" : "No");
+  printf ("\tOk to Add Notes: %s\n",
+	  permissions & POPPLER_PERMISSIONS_OK_TO_ADD_NOTES ? "Yes" : "No");
+  printf ("\tOk to Fill Forms: %s\n",
+	  permissions & POPPLER_PERMISSIONS_OK_TO_FILL_FORM ? "Yes" : "No");
+
+  printf ("\n");
   
   /* FIXME: print out the view prefs when we support it */
 
@@ -323,7 +340,7 @@ int main (int argc, char *argv[])
   PopplerRectangle area;
   gint num_images;
   gint num_forms;
-  gint form_id;
+  gint form_id = 0;
 
   if (argc != 3)
     FAIL ("usage: test-poppler-glib file://FILE PAGE");


More information about the poppler mailing list