[poppler] poppler/poppler: PDFDoc.h, 1.1.1.1, 1.2 XRef.h, 1.1.1.1, 1.2 XRef.cc, 1.2, 1.3

Brad Hards bradh at freedesktop.org
Tue Jul 5 05:15:06 PDT 2005


Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv25123/poppler

Modified Files:
	PDFDoc.h XRef.h XRef.cc 
Log Message:
Add some more user permissions properties - high resolution 
printing, document assembly, extraction for accessibility
and form completion.



Index: PDFDoc.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/PDFDoc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- PDFDoc.h	3 Mar 2005 19:46:01 -0000	1.1.1.1
+++ PDFDoc.h	5 Jul 2005 12:15:04 -0000	1.2
@@ -132,12 +132,21 @@
   // Check various permissions.
   GBool okToPrint(GBool ignoreOwnerPW = gFalse)
     { return xref->okToPrint(ignoreOwnerPW); }
+  GBool okToPrintHighRes(GBool ignoreOwnerPW = gFalse)
+    { return xref->okToPrintHighRes(ignoreOwnerPW); }
   GBool okToChange(GBool ignoreOwnerPW = gFalse)
     { return xref->okToChange(ignoreOwnerPW); }
   GBool okToCopy(GBool ignoreOwnerPW = gFalse)
     { return xref->okToCopy(ignoreOwnerPW); }
   GBool okToAddNotes(GBool ignoreOwnerPW = gFalse)
     { return xref->okToAddNotes(ignoreOwnerPW); }
+  GBool okToFillForm(GBool ignoreOwnerPW = gFalse)
+    { return xref->okToFillForm(ignoreOwnerPW); }
+  GBool okToAccessibility(GBool ignoreOwnerPW = gFalse)
+    { return xref->okToAccessibility(ignoreOwnerPW); }
+  GBool okToAssemble(GBool ignoreOwnerPW = gFalse)
+    { return xref->okToAssemble(ignoreOwnerPW); }
+
 
   // Is this document linearized?
   GBool isLinearized();

Index: XRef.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/XRef.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- XRef.h	3 Mar 2005 19:46:01 -0000	1.1.1.1
+++ XRef.h	5 Jul 2005 12:15:04 -0000	1.2
@@ -61,9 +61,13 @@
 
   // Check various permissions.
   GBool okToPrint(GBool ignoreOwnerPW = gFalse);
+  GBool okToPrintHighRes(GBool ignoreOwnerPW = gFalse);
   GBool okToChange(GBool ignoreOwnerPW = gFalse);
   GBool okToCopy(GBool ignoreOwnerPW = gFalse);
   GBool okToAddNotes(GBool ignoreOwnerPW = gFalse);
+  GBool okToFillForm(GBool ignoreOwnerPW = gFalse);
+  GBool okToAccessibility(GBool ignoreOwnerPW = gFalse);
+  GBool okToAssemble(GBool ignoreOwnerPW = gFalse);
 
   // Get catalog object.
   Object *getCatalog(Object *obj) { return fetch(rootNum, rootGen, obj); }

Index: XRef.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/XRef.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- XRef.cc	16 Mar 2005 15:51:36 -0000	1.2
+++ XRef.cc	5 Jul 2005 12:15:04 -0000	1.3
@@ -37,12 +37,17 @@
 #ifndef NO_DECRYPTION
 //------------------------------------------------------------------------
 // Permission bits
+// Note that the PDF spec uses 1 base (eg bit 3 is 1<<2)
 //------------------------------------------------------------------------
 
-#define permPrint    (1<<2)
-#define permChange   (1<<3)
-#define permCopy     (1<<4)
-#define permNotes    (1<<5)
+#define permPrint         (1<<2)  // bit 3
+#define permChange        (1<<3)  // bit 4
+#define permCopy          (1<<4)  // bit 5
+#define permNotes         (1<<5)  // bit 6
+#define permFillForm      (1<<8)  // bit 9
+#define permAccessibility (1<<9)  // bit 10
+#define permAssemble      (1<<10) // bit 11
+#define permHighResPrint  (1<<11) // bit 12
 #define defPermFlags 0xfffc
 #endif
 
@@ -899,6 +904,24 @@
 #endif
 }
 
+// we can print at high res if we are only doing security handler revision
+// 2 (and we are allowed to print at all), or with security handler rev
+// 3 and we are allowed to print, and bit 12 is set.
+GBool XRef::okToPrintHighRes(GBool ignoreOwnerPW) {
+#ifndef NO_DECRYPTION
+  if (2 == encRevision) {
+    return (okToPrint(ignoreOwnerPW));
+  } else if (encRevision >= 3) {
+    return (okToPrint(ignoreOwnerPW) && (permFlags & permHighResPrint));
+  } else {
+    // something weird - unknown security handler version
+    return gFalse;
+  }
+#else
+  return gTrue;
+#endif
+}
+
 GBool XRef::okToChange(GBool ignoreOwnerPW) {
 #ifndef NO_DECRYPTION
   return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permChange);
@@ -923,6 +946,30 @@
 #endif
 }
 
+GBool XRef::okToFillForm(GBool ignoreOwnerPW) {
+#ifndef NO_DECRYPTION
+  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permFillForm);
+#else
+  return gTrue;
+#endif
+}
+
+GBool XRef::okToAccessibility(GBool ignoreOwnerPW) {
+#ifndef NO_DECRYPTION
+  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permAccessibility);
+#else
+  return gTrue;
+#endif
+}
+
+GBool XRef::okToAssemble(GBool ignoreOwnerPW) {
+#ifndef NO_DECRYPTION
+  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permAssemble);
+#else
+  return gTrue;
+#endif
+}
+
 Object *XRef::fetch(int num, int gen, Object *obj) {
   XRefEntry *e;
   Parser *parser;



More information about the poppler mailing list